Changeset 8721

Show
Ignore:
Timestamp:
02/17/09 19:28:59 (4 years ago)
Author:
mcarrick
Message:

restructured, removed inheritance

Location:
ossiedev/branches/mcarrick/DPD
Files:
1 added
1 removed
13 modified

Legend:

Unmodified
Added
Removed
  • ossiedev/branches/mcarrick/DPD/DPDParser.cpp

    r8719 r8721  
    11#include "DPDParser.h" 
    22 
    3 DPDParser::DPDParser(TiXmlElement *elem):DevicePkg(elem) 
     3DPDParser::DPDParser(TiXmlElement *elem) 
    44{ 
     5        devPkg = new DevicePkg(elem); 
    56} 
    67 
    78DPDParser::~DPDParser() 
    89{ 
     10        delete devPkg; 
    911} 
    1012 
     13DevicePkg* DPDParser::getDevicePkg() 
     14{ 
     15        return devPkg; 
     16} 
     17 
  • ossiedev/branches/mcarrick/DPD/DPDParser.h

    r8719 r8721  
    1212 
    1313//class OSSIEPARSER_API DPDParser:public DevicePkg 
    14 class DPDParser:public DevicePkg 
     14class DPDParser 
    1515{ 
    1616        public: 
     
    1818                DPDParser(TiXmlElement *elem); 
    1919                ~DPDParser(); 
     20 
     21                DevicePkg* getDevicePkg(); 
    2022 
    2123        protected: 
     
    2527                DPDParser(const DPDParser &aDPDParser); // no copying 
    2628 
     29                DevicePkg *devPkg; 
    2730}; 
    2831 
  • ossiedev/branches/mcarrick/DPD/DeviceClass.cpp

    r8713 r8721  
    3636} 
    3737 
    38 std::vector <std::string> DeviceClass::getDeviceClass() 
     38std::vector <std::string> DeviceClass::getClass() 
    3939{ 
    4040        return deviceClass; 
  • ossiedev/branches/mcarrick/DPD/DeviceClass.h

    r8699 r8721  
    1616                ~DeviceClass(); 
    1717 
    18                 std::vector <std::string> getDeviceClass(); 
     18                std::vector <std::string> getClass(); 
    1919 
    2020        protected: 
  • ossiedev/branches/mcarrick/DPD/DevicePkg.cpp

    r8713 r8721  
    55#include "include/tinyxml.h" 
    66 
    7 DevicePkg::DevicePkg(TiXmlElement *elem):HWDeviceRegistration(elem->FirstChildElement("hwdeviceregistration")) 
     7DevicePkg::DevicePkg(TiXmlElement *elem) 
    88{ 
    99        parseElement(elem); // parse elements within devicepkg 
     10        hwDev = new HWDeviceRegistration(elem->FirstChildElement("hwdeviceregistration")); 
    1011} 
    1112 
    1213DevicePkg::~DevicePkg() 
    1314{ 
     15        delete hwDev; 
    1416} 
    1517 
     
    119121} 
    120122 
    121 std::string DevicePkg::getDevPkgID() 
     123std::string DevicePkg::getID() 
    122124{ 
    123125        return id; 
    124126} 
    125127 
    126 std::string DevicePkg::getDevPkgName() 
     128std::string DevicePkg::getName() 
    127129{ 
    128130        return name; 
    129131} 
    130132 
    131 std::string DevicePkg::getDevPkgVersion() 
     133std::string DevicePkg::getVersion() 
    132134{ 
    133135        return version; 
    134136} 
    135137 
    136 std::string DevicePkg::getDevPkgTitle() 
     138std::string DevicePkg::getTitle() 
    137139{ 
    138140        return title; 
    139141} 
    140142 
    141 std::string DevicePkg::getDevPkgAuthor() 
     143std::string DevicePkg::getAuthor() 
    142144{ 
    143145        return author; 
    144146} 
    145147 
    146 std::string DevicePkg::getDevPkgDescription() 
     148std::string DevicePkg::getDescription() 
    147149{ 
    148150        return description; 
    149151} 
    150152 
     153HWDeviceRegistration* DevicePkg::getHWDeviceRegistration() 
     154{ 
     155        return hwDev; 
     156} 
  • ossiedev/branches/mcarrick/DPD/DevicePkg.h

    r8713 r8721  
    1212 
    1313//class OSSIEPARSER_API DevicePkg 
    14 class DevicePkg:public HWDeviceRegistration 
     14class DevicePkg 
    1515{ 
    1616        public: 
     
    1818                ~DevicePkg(); 
    1919 
    20                 std::string getDevPkgID(); 
    21                 std::string getDevPkgName(); 
    22                 std::string getDevPkgVersion(); 
    23                 std::string getDevPkgTitle(); 
    24                 std::string getDevPkgAuthor(); 
    25                 std::string getDevPkgDescription(); 
     20                std::string getID(); 
     21                std::string getName(); 
     22                std::string getVersion(); 
     23                std::string getTitle(); 
     24                std::string getAuthor(); 
     25                std::string getDescription(); 
     26 
     27                HWDeviceRegistration* getHWDeviceRegistration(); 
    2628 
    2729        protected: 
     
    4345                std::string name; 
    4446                std::string version; 
    45  
    4647                std::string title; 
    4748                std::string author; 
    4849                std::string description; 
    4950 
    50                 HWDeviceRegistration hwDev(TiXmlElement *elem); 
     51                HWDeviceRegistration *hwDev; 
    5152}; 
    5253 
  • ossiedev/branches/mcarrick/DPD/DevicePkgRef.cpp

    r8713 r8721  
    5050} 
    5151 
    52 std::string DevicePkgRef::getDevPkgRefType() 
     52std::string DevicePkgRef::getType() 
    5353{ 
    5454        return type; 
    5555} 
    5656 
    57 std::string DevicePkgRef::getDevPkgRefLocalFile() 
     57std::string DevicePkgRef::getLocalFile() 
    5858{ 
    5959        return localfile; 
  • ossiedev/branches/mcarrick/DPD/DevicePkgRef.h

    r8703 r8721  
    1616                ~DevicePkgRef(); 
    1717 
    18                 std::string getDevPkgRefType(); 
    19                 std::string getDevPkgRefLocalFile(); 
     18                std::string getType(); 
     19                std::string getLocalFile(); 
    2020 
    2121        protected: 
  • ossiedev/branches/mcarrick/DPD/HWDeviceRegistration.cpp

    r8719 r8721  
    55#include "include/tinyxml.h" 
    66 
    7 HWDeviceRegistration::HWDeviceRegistration(TiXmlElement *elem):PropertyFile(elem->FirstChildElement("propertyfile")), 
    8 DeviceClass(elem->FirstChildElement("deviceclass")) 
     7HWDeviceRegistration::HWDeviceRegistration(TiXmlElement *elem) 
    98{ 
    109        parseElement(elem); // parse tags in hwdeviceregistration, with exception of propertyfile, deviceclass, childhwdevice 
     10 
     11        propFile = new PropertyFile(elem->FirstChildElement("propertyfile")); 
     12        devClass = new DeviceClass(elem->FirstChildElement("deviceclass")); 
     13 
    1114        constructChildHWDevice(elem->FirstChildElement("childhwdevice"));  
    1215} 
     
    1720        { 
    1821                delete childHWDevices[i]; 
    19         } 
     22                childHWDevices[i] = NULL; 
     23        } 
     24 
     25        delete propFile; 
     26        propFile = NULL; 
     27        delete devClass; 
     28        devClass = NULL; 
    2029 
    2130} 
     
    145154} 
    146155 
    147 ChildHWDevice::ChildHWDevice(TiXmlElement *elem):DevicePkgRef(elem->FirstChildElement("devicepkgref")) 
     156ChildHWDevice::ChildHWDevice(TiXmlElement *elem) 
    148157{ 
    149158        hwDeviceReg = new HWDeviceRegistration(elem->FirstChildElement("hwdeviceregistration")); 
     159        devPkgRef = new DevicePkgRef(elem->FirstChildElement("devicepkgref")); 
    150160} 
    151161 
     
    160170} 
    161171 
    162 std::string HWDeviceRegistration::getHWDevRegID() 
     172PropertyFile* HWDeviceRegistration::getPropertyFile() 
     173{ 
     174        return propFile; 
     175} 
     176 
     177DeviceClass* HWDeviceRegistration::getDeviceClass() 
     178{ 
     179        return devClass; 
     180} 
     181 
     182std::string HWDeviceRegistration::getID() 
    163183{ 
    164184        return id; 
    165185} 
    166186 
    167 std::string HWDeviceRegistration::getHWDevRegVersion() 
     187std::string HWDeviceRegistration::getVersion() 
    168188{ 
    169189        return version; 
    170190} 
    171191 
    172 std::string HWDeviceRegistration::getHWDevRegName() 
     192std::string HWDeviceRegistration::getName() 
    173193{ 
    174194        return name; 
    175195} 
    176196 
    177 std::string HWDeviceRegistration::getHWDevRegDescription() 
     197std::string HWDeviceRegistration::getDescription() 
    178198{ 
    179199        return description; 
    180200} 
    181201 
    182 std::string HWDeviceRegistration::getHWDevRegManufacturer() 
     202std::string HWDeviceRegistration::getManufacturer() 
    183203{ 
    184204        return manufacturer; 
    185205} 
    186206 
    187 std::string HWDeviceRegistration::getHWDevRegModelNumber() 
     207std::string HWDeviceRegistration::getModelNumber() 
    188208{ 
    189209        return modelnumber; 
     
    195215} 
    196216 
    197  
    198  
    199  
    200  
     217DevicePkgRef* ChildHWDevice::getDevicePkgRef() 
     218{ 
     219        return devPkgRef; 
     220} 
     221 
     222 
     223 
  • ossiedev/branches/mcarrick/DPD/HWDeviceRegistration.h

    r8712 r8721  
    1717 
    1818//class OSSIEPARSER_API HWDeviceRegistration 
    19 class HWDeviceRegistration:public PropertyFile, public DeviceClass 
     19class HWDeviceRegistration 
    2020{ 
    2121        public: 
     
    2323                ~HWDeviceRegistration(); 
    2424 
    25                 std::string getHWDevRegID(); 
    26                 std::string getHWDevRegVersion(); 
    27                 std::string getHWDevRegName(); 
    28                 std::string getHWDevRegDescription(); 
    29                 std::string getHWDevRegManufacturer(); 
    30                 std::string getHWDevRegModelNumber(); 
     25                std::string getID(); 
     26                std::string getVersion(); 
     27                std::string getName(); 
     28                std::string getDescription(); 
     29                std::string getManufacturer(); 
     30                std::string getModelNumber(); 
    3131 
    3232                std::vector <ChildHWDevice*> getChildHWDevice(); 
     33                PropertyFile* getPropertyFile(); 
     34                DeviceClass* getDeviceClass(); 
    3335 
    3436        protected: 
     
    4850                HWDeviceRegistration(const HWDeviceRegistration& aHWDeviceRegistration); // no copying 
    4951 
    50                 std::vector <ChildHWDevice*> childHWDevices; 
    51  
    5252                std::string id; 
    5353                std::string version; 
     
    5656                std::string manufacturer; 
    5757                std::string modelnumber; 
     58 
     59                std::vector <ChildHWDevice*> childHWDevices; 
     60                PropertyFile *propFile; 
     61                DeviceClass *devClass; 
    5862}; 
    5963 
    6064// class OSSIEPARSER_API ChildHWDevice:public DevicePkgRef 
    61 class ChildHWDevice:public DevicePkgRef 
     65class ChildHWDevice 
    6266{ 
    6367        public: 
     
    6670 
    6771                HWDeviceRegistration* getHWDeviceRegistration(); 
     72                DevicePkgRef* getDevicePkgRef(); 
    6873 
    6974        private: 
     
    7277 
    7378                HWDeviceRegistration *hwDeviceReg; 
     79                DevicePkgRef *devPkgRef; 
    7480}; 
    7581 
  • ossiedev/branches/mcarrick/DPD/PropertyFile.cpp

    r8713 r8721  
    5050} 
    5151 
    52 std::string PropertyFile::getPropFileType() 
     52std::string PropertyFile::getType() 
    5353{ 
    5454        return type; 
    5555} 
    5656 
    57 std::string PropertyFile::getPropFileLocalFile() 
     57std::string PropertyFile::getLocalFile() 
    5858{ 
    5959        return localfile; 
  • ossiedev/branches/mcarrick/DPD/PropertyFile.h

    r8699 r8721  
    1515                PropertyFile(TiXmlElement *elem); 
    1616                ~PropertyFile(); 
    17                 std::string getPropFileType(); 
    18                 std::string getPropFileLocalFile(); 
     17                std::string getType(); 
     18                std::string getLocalFile(); 
    1919 
    2020        protected: 
  • ossiedev/branches/mcarrick/DPD/testApp.cpp

    r8719 r8721  
    1 //#include "DevicePkg.h" 
    21#include "DPDParser.h" 
    32 
     
    1918        std::cout << "testDPDParser()" << std::endl; 
    2019 
    21         char *root = "xml/devicePkg.xml"; 
     20        char *root = "xml/test.dpd.xml"; 
    2221        TiXmlDocument xmlDoc(root); // set up path to XML through char string 
    2322 
     
    2928                DPDParser parse(DPD); 
    3029 
    31                 std::cout << std::endl << std::endl; 
    32                 std::cout << "<devpkg id=" << parse.getDevPkgID() << " version=" << parse.getDevPkgVersion(); 
    33                         std::cout << " name=" << parse.getDevPkgName() << ">" << std::endl; 
    34                 std::cout << "  <author>" << parse.getDevPkgAuthor() << "</author>" << std::endl; 
    35                 std::cout << "  <description>" << parse.getDevPkgDescription() << "</description>" << std::endl; 
    36                 std::cout << "  <title>" << parse.getDevPkgTitle() << "</title>" << std::endl; 
    37                 std::cout << "  <hwdeviceregistration id=" << parse.getHWDevRegID() << " version=" << parse.getHWDevRegVersion(); 
    38                         std::cout << " name=" << parse.getHWDevRegName() << ">" << std::endl; 
    39  
    40                 std::cout << "          <propertyfile type=" << parse.getPropFileType() << ">" << std::endl; 
    41                 std::cout << "                  <localfile name=" << parse.getPropFileLocalFile() << "/>" << std::endl; 
    42                 std::cout << "          </propertyfile>" << std::endl; 
    43                 std::cout << "          <description>" << parse.getHWDevRegDescription() << "</description>" << std::endl; 
    44                 std::cout << "          <manufacturer>" << parse.getHWDevRegManufacturer() << "</manufacturer>" << std::endl; 
    45                 std::cout << "          <modelnumber>" << parse.getHWDevRegModelNumber() << "</modelnumber>" << std::endl; 
    46                 std::cout << "          <deviceclass>" << std::endl; 
    47                 for (int i = 0; i < parse.getDeviceClass().size(); i++) 
    48                 { 
    49                 std::cout << "                  <class>" << parse.getDeviceClass()[i] << "</class>" << std::endl; 
    50                 } 
    51                 std::cout << "          </deviceclass>" << std::endl; 
    52  
    53                 for (int i = 0; i < parse.getChildHWDevice().size(); i++) 
    54                 { 
    55                 std::cout << "          <childhwdevice>" << std::endl; 
    56                 std::cout << "                  <hwdeviceregistration id=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegID(); 
    57                         std::cout << " version=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegVersion(); 
    58                         std::cout << " name=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegName() << ">" << std::endl; 
    59                 std::cout << "                          <propertyfile type=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getPropFileType(); 
    60                         std::cout << ">" << std::endl; 
    61                 std::cout << "                                  <localfile name=" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getPropFileLocalFile(); 
    62                         std::cout << "/>" << std::endl; 
    63                 std::cout << "                          </propertyfile>" << std::endl; 
    64  
    65                 std::cout << "                          <description>" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegDescription(); 
    66                         std::cout << "</descripton>" << std::endl; 
    67                 std::cout << "                          <manufacturer>" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegManufacturer(); 
    68                         std::cout << "</manufacturer>" << std::endl; 
    69                 std::cout << "                          <modelnumber>" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getHWDevRegModelNumber(); 
    70                         std::cout << "</modelnumber>" << std::endl; 
    71                 std::cout << "                          <deviceclass>" << std::endl; 
    72                 for (int k = 0; k < parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getDeviceClass().size(); k++) 
    73                 { 
    74                 std::cout << "                                  <class>" << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getDeviceClass()[k]; 
    75                         std::cout << "</class>" << std::endl; 
    76                 } 
    77                 std::cout << "                          </deviceclass>" << std::endl; 
    78  
    79  
    80                 for (int j = 0; j < parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getChildHWDevice().size(); j++) 
    81                 { 
    82                 std::cout << "                          <childhwdevice>" << std::endl; 
    83                 std::cout << "                                  <hwdeviceregistration id="; 
    84                         std::cout << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getChildHWDevice()[j]->getHWDeviceRegistration()->getHWDevRegID(); 
    85                         std::cout << " version="; 
    86                         std::cout << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getChildHWDevice()[j]->getHWDeviceRegistration()->getHWDevRegVersion(); 
    87                         std::cout << " name="; 
    88                         std::cout << parse.getChildHWDevice()[i]->getHWDeviceRegistration()->getChildHWDevice()[j]->getHWDeviceRegistration()->getHWDevRegName(); 
    89                         std::cout << ">" << std::endl; 
    90                         std::cout << "                                  ..." << std::endl; 
    91                 std::cout << "                                  </hwdeviceregistration>" << std::endl; 
    92                 std::cout << "                          </childhwdevice>" << std::endl; 
    93                 } 
    94  
    95                 } 
    96                 std::cout << "  </hwdeviceregistration>" << std::endl; 
    97                 std::cout << "</devpkg>" << std::endl; 
     30                std::cout << "devpkg: id=" << parse.getDevicePkg()->getID() << " name=" << parse.getDevicePkg()->getName(); 
     31                        std::cout << " version=" << parse.getDevicePkg()->getVersion() << std::endl; 
     32                std::cout << "  title: " << parse.getDevicePkg()->getTitle() << std::endl; 
     33                std::cout << "  author: " << parse.getDevicePkg()->getAuthor() << std::endl; 
     34                std::cout << "  description: " << parse.getDevicePkg()->getDescription() << std::endl; 
     35                std::cout << "  hwdeviceregistration: id=" << parse.getDevicePkg()->getHWDeviceRegistration()->getID() << std::endl; 
     36                std::cout << "          deviceclass" << std::endl; 
     37                std::cout << "                  class: " << parse.getDevicePkg()->getHWDeviceRegistration()->getDeviceClass()->getClass()[0] << std::endl; 
     38                std::cout << "          childhwdevice: " << std::endl; 
     39                std::cout << "                  hwdeviceregistration: id=" << parse.getDevicePkg()->getHWDeviceRegistration()->getChildHWDevice()[0]->getHWDeviceRegistration()->getID() << std::endl; 
    9840 
    9941        }