Clothe Class Reference

#include <clothe.h>

List of all members.

Public Member Functions

 ~Clothe ()
 Clothe (xmlpp::Element *xml, std::map< std::string, Member * > &members_lst)
 Clothe (Clothe *c, std::map< std::string, Member * > &members_lst)

Public Attributes

std::string name
std::vector< Member * > layers


Detailed Description

Definition at line 32 of file clothe.h.


Constructor & Destructor Documentation

Clothe::~Clothe (  ) 

Definition at line 87 of file clothe.cpp.

00088 {
00089   layers.clear();
00090 }

Clothe::Clothe ( xmlpp::Element *  xml,
std::map< std::string, Member * > &  members_lst 
)

Definition at line 28 of file clothe.cpp.

00029 {
00030   XmlReader::ReadStringAttr( xml, "name", name);
00031 
00032   xmlpp::Node::NodeList nodes = xml -> get_children("member");
00033   xmlpp::Node::NodeList::iterator
00034     it=nodes.begin(),
00035     end=nodes.end();
00036 
00037   for (; it != end; ++it)
00038   {
00039     xmlpp::Element *elem = dynamic_cast<xmlpp::Element*> (*it);
00040     assert (elem != NULL);
00041     std::string att;
00042     if (!XmlReader::ReadStringAttr(elem, "name", att))
00043     {
00044       std::cerr << "Malformed attached member definition" << std::endl;
00045       continue;
00046     }
00047 
00048     Member* member = NULL;
00049     if(members_lst.find(att) != members_lst.end())
00050     {
00051       member = members_lst.find(att)->second;
00052     }
00053     else
00054     {
00055       std::cerr << "Undefined member \"" << att << "\"" << std::endl;
00056     }
00057 
00058     int lay=0;
00059     if(XmlReader::ReadIntAttr(elem, "layer", lay))
00060     {
00061       if((uint)lay >= layers.size())
00062         layers.resize( lay+1, (Member*)NULL);
00063       layers[lay] = member;
00064     }
00065   }
00066 
00067   std::vector<Member*>::iterator i = layers.begin();
00068   while( i != layers.end())
00069   if(*i!=NULL)
00070     i++;
00071   else
00072     i=layers.erase(i);
00073 }

Here is the call graph for this function:

Clothe::Clothe ( Clothe c,
std::map< std::string, Member * > &  members_lst 
)

Definition at line 75 of file clothe.cpp.

00076 {
00077   name = c->name;
00078 
00079   for (std::vector<Member*>::iterator it = c->layers.begin();
00080       it != c->layers.end();
00081       ++it)
00082   {
00083     layers.push_back(members_lst.find((*it)->name)->second);
00084   }
00085 }


Member Data Documentation

std::vector<Member*> Clothe::layers

Definition at line 36 of file clothe.h.

std::string Clothe::name

Definition at line 35 of file clothe.h.


The documentation for this class was generated from the following files:
Generated on Mon Jan 1 13:41:52 2007 for Wormux by  doxygen 1.4.7