root/ossiedev/branches/mcarrick/ossie/parser/DevicePkgRef.cpp @ 8725

Revision 8725, 2.2 KB (checked in by mcarrick, 4 years ago)

adding license headers to DPD parser files

Line 
1/*******************************************************************************
2 Copyright 2009 Virginia Polytechnic Institute and State University
3
4 This file is part of the OSSIE Parser.
5
6 OSSIE Parser is free software; you can redistribute it and/or modify
7 it under the terms of the Lesser GNU General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 OSSIE Parser is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 Lesser GNU General Public License for more details.
15
16 You should have received a copy of the Lesser GNU General Public License
17 along with OSSIE Parser; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20 Even though all code is original, the architecture of the OSSIE Parser is based
21 on the architecture of the CRCs SCA Reference Implementation (SCARI)
22 see: http://www.crc.ca/en/html/rmsc/home/sdr/projects/scari
23*********************************************************************************/
24
25#include "ossie/DevicePkgRef.h"
26
27#include <iostream>
28
29DevicePkgRef::DevicePkgRef(TiXmlElement *elem)
30{
31        parseElement(elem);
32}
33
34DevicePkgRef::~DevicePkgRef()
35{
36}
37
38void DevicePkgRef::parseElement(TiXmlElement *elem)
39{
40        std::cout << "DEBUG: parsing device pkg ref..." << std::endl;
41
42        parseAttributes(elem); // store type from devicepkgref tag
43        parseChildElements(elem);
44
45}
46
47void DevicePkgRef::parseAttributes(TiXmlElement *elem)
48{
49        if (elem->Attribute("type"))
50        {
51                type = elem->Attribute("type");
52        }
53        else
54        {
55                std::cout << "ERROR: Could not find 'type' attribute in devicepkgref tag" << std::endl;
56                exit(-1);
57        }
58}
59
60void DevicePkgRef::parseChildElements(TiXmlElement *elem)
61{
62        TiXmlElement *local = elem->FirstChildElement("localfile");
63        if (local)
64        {
65                localfile = local->Attribute("name");
66        }
67        else
68        {
69                std::cout << "ERROR: Could not find 'name' attribute in localfile tag" << std::endl;
70                exit(-1);
71        }
72}
73
74std::string DevicePkgRef::getType()
75{
76        return type;
77}
78
79std::string DevicePkgRef::getLocalFile()
80{
81        return localfile;
82}
83
84
Note: See TracBrowser for help on using the browser.