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

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

DeviceManager? now supports multiple implementations

  • 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(false), ifCompositePartOf(false), ifDomainManager(false)
35{
36    DEBUG(4, DCDComponentPlacement, "In constructor.");
37
38    parseDeployOnDevice(elem);
39    parseCompositePartOfDevice(elem);
40    parseDPDFileName(elem);
41    parseInstantiations(elem);
42
43    DEBUG(4, DCDComponentPlacement, "Leaving constructor.");
44}
45
46
47
48DCDComponentPlacement::~DCDComponentPlacement()
49{
50}
51
52
53void DCDComponentPlacement::parseDeployOnDevice(TiXmlElement *elem)
54{
55    DEBUG(4, DCDComponentPlacement, "In parseDeployOnDevice.");
56
57    TiXmlElement *deploy = elem->FirstChildElement("deployondevice");
58
59    if(deploy) {
60        ifDeployOn = true;
61        deployOnDeviceID = deploy->Attribute("refid");
62    } else {
63        DEBUG(4, DCDComponentPlacement, "deployondevice NOT found")
64    }
65}
66
67
68void DCDComponentPlacement::parseCompositePartOfDevice(TiXmlElement *elem)
69{
70    DEBUG(4, DCDComponentPlacement, "In parseCompositePartOfDevice.");
71
72    TiXmlElement *composite = elem->FirstChildElement("compositepartofdevice");
73
74    if (composite) {
75        ifCompositePartOf = true;
76        compositePartOfDeviceID = composite->Attribute("refid");
77    }
78}
79
80
81void DCDComponentPlacement::parseDPDFileName(TiXmlElement *elem)
82{
83    DEBUG(4, DCDComponentPlacement, "In DPDFileName.");
84
85    TiXmlElement *DPD = elem->FirstChildElement("devicepkgfile");
86
87    if (DPD) {
88        TiXmlElement *local = DPD->FirstChildElement("localfile");
89        DPDFile = local->Attribute("name");
90    }
91    else
92    {
93        DEBUG(4, DCDComponentPlacement, "devicepkgfile tag not found, DPD not referenced");
94    }
95}
96
97
98void DCDComponentPlacement::parseInstantiations(TiXmlElement *elem)
99{
100    DEBUG(4, DCDComponentPlacement, "In parseInstantiations.");
101
102    TiXmlElement *instance = elem->FirstChildElement("componentinstantiation");
103
104    std::vector <ComponentInstantiation* > _instantiations;
105
106    for (; instance; instance = instance->NextSiblingElement()) {
107       
108        _instantiations.push_back((ComponentInstantiation* ) new DCDComponentInstantiation(instance));
109        _instantiationId = _instantiations.back()->getID();
110        _usageName = _instantiations.back()->getUsageName();
111    }
112}
113
114
115const char* DCDComponentPlacement::getDMDFile()
116{
117    return DMDFile.c_str();
118}
119
120
121const char* DCDComponentPlacement::getDeployOnDeviceID()
122{
123    return deployOnDeviceID.c_str();
124}
125
126
127const char* DCDComponentPlacement::getCompositePartOfDeviceID()
128{
129    return compositePartOfDeviceID.c_str();
130}
131
132std::string DCDComponentPlacement::getDPDFile()
133{
134    return DPDFile.c_str();
135}
136
137
138bool DCDComponentPlacement::isDeployOn()
139{
140    return ifDeployOn;
141}
142
143
144bool DCDComponentPlacement::isCompositePartOf()
145{
146    return ifCompositePartOf;
147}
148
149
150bool DCDComponentPlacement::isDomainManager()
151{
152    return ifDomainManager;
153}
154
155
156const char *DCDComponentPlacement::getFileRefId()
157{
158    return _fileRefId.c_str();
159}
160
161const char *DCDComponentPlacement::getInstantiationId()
162{
163    return _instantiationId.c_str();
164}
165
166const char *DCDComponentPlacement::getUsageName()
167{
168    return _usageName.c_str();
169}
Note: See TracBrowser for help on using the browser.