root/ossiedev/trunk/system/ossie/parser/DCDComponentPlacement.cpp @ 8759

Revision 8759, 4.3 KB (checked in by shereef, 4 years ago)

DeviceManager? now searches for matching Device implementations but it's not working yet

  • Property svn:eol-style set to native
Line 
1/*******************************************************************************
2
3Copyright 2004, 2007 Virginia Polytechnic Institute and State University
4
5This file is part of the OSSIE Parser.
6
7OSSIE Parser is free software; you can redistribute it and/or modify
8it under the terms of the Lesser GNU General Public License as published by
9the Free Software Foundation; either version 2.1 of the License, or
10(at your option) any later version.
11
12OSSIE Parser is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15Lesser GNU General Public License for more details.
16
17You should have received a copy of the Lesser GNU General Public License
18along with OSSIE Parser; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
21Even though all code is original, the architecture of the OSSIE Parser is based
22on the architecture of the CRCs SCA Reference Implementation(SCARI)
23see: http://www.crc.ca/en/html/rmsc/home/sdr/projects/scari
24
25*********************************************************************************/
26#include <iostream>
27#include <string>
28
29#include "ossie/DCDComponentPlacement.h"
30
31#include "tinyxml.h"
32
33// the ifDeployOn initialization has been set from FALSE to true
34DCDComponentPlacement::DCDComponentPlacement(TiXmlElement *elem) : ComponentPlacement(elem), ifDeployOn(/*true*/false), ifCompositePartOf(false), ifDomainManager(false)
35{
36    DEBUG(4, DCDComponentPlacement, "In constructor.");
37//    DEBUG(4, DCDComponentPlacement, "WARNING: ifDeployOn is initalized to TRUE");
38
39    parseDeployOnDevice(elem);
40    parseCompositePartOfDevice(elem);
41    parseDPDFileName(elem);
42    parseInstantiations(elem);
43
44    DEBUG(4, DCDComponentPlacement, "Leaving constructor.");
45}
46
47
48
49DCDComponentPlacement::~DCDComponentPlacement()
50{
51}
52
53
54void DCDComponentPlacement::parseDeployOnDevice(TiXmlElement *elem)
55{
56    DEBUG(4, DCDComponentPlacement, "In parseDeployOnDevice.");
57
58    TiXmlElement *deploy = elem->FirstChildElement("deployondevice");
59
60    if(deploy) {
61        deployOnDeviceID = deploy->Attribute("refid");
62    }
63}
64
65
66void DCDComponentPlacement::parseCompositePartOfDevice(TiXmlElement *elem)
67{
68    DEBUG(4, DCDComponentPlacement, "In parseCompositePartOfDevice.");
69
70    TiXmlElement *composite = elem->FirstChildElement("compositepartofdevice");
71
72    if (composite) {
73        compositePartOfDeviceID = composite->Attribute("refid");
74    }
75}
76
77
78void DCDComponentPlacement::parseDPDFileName(TiXmlElement *elem)
79{
80    DEBUG(4, DCDComponentPlacement, "In DPDFileName.");
81
82    TiXmlElement *DPD = elem->FirstChildElement("devicepkgfile");
83
84    if (DPD) {
85        TiXmlElement *local = DPD->FirstChildElement("localfile");
86        DPDFile = local->Attribute("name");
87    }
88    else
89    {
90        DEBUG(4, DCDComponentPlacement, "devicepkgfile tag not found, DPD not referenced");
91    }
92}
93
94
95void DCDComponentPlacement::parseInstantiations(TiXmlElement *elem)
96{
97    DEBUG(4, DCDComponentPlacement, "In parseInstantiations.");
98
99    TiXmlElement *instance = elem->FirstChildElement("componentinstantiation");
100
101    std::vector <ComponentInstantiation* > _instantiations;
102
103    for (; instance; instance = instance->NextSiblingElement()) {
104       
105        _instantiations.push_back((ComponentInstantiation* ) new DCDComponentInstantiation(instance));
106        _instantiationId = _instantiations.back()->getID();
107        _usageName = _instantiations.back()->getUsageName();
108    }
109}
110
111
112const char* DCDComponentPlacement::getDMDFile()
113{
114    return DMDFile.c_str();
115}
116
117
118const char* DCDComponentPlacement::getDeployOnDeviceID()
119{
120    return deployOnDeviceID.c_str();
121}
122
123
124const char* DCDComponentPlacement::getCompositePartOfDeviceID()
125{
126    return compositePartOfDeviceID.c_str();
127}
128
129std::string DCDComponentPlacement::getDPDFile()
130{
131    return DPDFile.c_str();
132}
133
134
135bool DCDComponentPlacement::isDeployOn()
136{
137    return ifDeployOn;
138}
139
140
141bool DCDComponentPlacement::isCompositePartOf()
142{
143    return ifCompositePartOf;
144}
145
146
147bool DCDComponentPlacement::isDomainManager()
148{
149    return ifDomainManager;
150}
151
152
153const char *DCDComponentPlacement::getFileRefId()
154{
155    return _fileRefId.c_str();
156}
157
158const char *DCDComponentPlacement::getInstantiationId()
159{
160    return _instantiationId.c_str();
161}
162
163const char *DCDComponentPlacement::getUsageName()
164{
165    return _usageName.c_str();
166}
Note: See TracBrowser for help on using the browser.