00001 00002 #include <utility> 00003 #include <map> 00004 #include <list> 00005 #include "Node.h" 00006 00007 00008 class InstanceNode: public Node 00009 { 00010 public: 00011 InstanceNode(void){node_type = INSTANCE_NODE; id = "empty"; type= "empty";}; 00012 char* id; 00013 char* type; 00014 int node_type; 00015 00016 OwnSlotsNode own_slots; 00017 void addOwnSlots(OwnSlotsNode* own_slots); 00018 virtual void printNode(); 00019 virtual int qualifyNode(); 00020 }; 00021 00022 void InstanceNode::addOwnSlots(OwnSlotsNode* sn) 00023 { 00024 own_slots.addOwnSlot(&sn->own_slot); 00025 } 00026 00027 00028 00029 void InstanceNode::printNode() 00030 { 00031 cout<<"InstanceNode: Node node_type is "<<node_type<<"\n"; 00032 cout<<"InstanceNode: Node type is "<<type<<"\n"; 00033 cout<<"InstanceNode: Node id is "<<id<<"\n"; 00034 own_slots.printNode(); 00035 } 00036 int InstanceNode::qualifyNode() 00037 {return node_type;} 00038 00039 class InstancesNode: public Node 00040 { 00041 public: 00042 InstancesNode(void){node_type = INSTANCES_NODE;}; 00043 int node_type; 00044 NodeGroup instances; 00045 00046 void addInstance(InstanceNode* in); 00047 virtual void printNode(); 00048 virtual int qualifyNode(); 00049 }; 00050 00051 void InstancesNode::addInstance(InstanceNode* in) 00052 { 00053 instances.Sons.push_back(new InstanceNode); 00054 InstanceNode* ilp = (InstanceNode*) instances.Sons.front(); 00055 00056 ilp->addOwnSlots(&in->own_slots); 00057 00058 } 00059 00060 void InstancesNode::printNode() 00061 { 00062 cout<<"InstancesNode: Node type is "<<node_type<<"\n"; 00063 list<Node*>::iterator it; 00064 for(it = instances.Sons.begin(); it!=instances.Sons.end(); ++it) 00065 (*it)->printNode(); 00066 } 00067 00068 int InstancesNode::qualifyNode() 00069 {return node_type;}