contrib/gel/vtol/vtol_macros.h
Go to the documentation of this file.
00001 // This is gel/vtol/vtol_macros.h
00002 #ifndef VTOL_MACROS_H
00003 #define VTOL_MACROS_H
00004 //:
00005 // \file
00006 // \verbatim
00007 //  Modifications
00008 //   05/13/98  RIH replaced append by insert_after to avoid n^2 behavior
00009 // \endverbatim
00010 
00011 #include <vcl_vector.h>
00012 #include <vcl_list.h>
00013 
00014 #define SEL_SUP(suptype,target)\
00015   vcl_vector<suptype *> *new_list=new vcl_vector<suptype *>();\
00016   vcl_vector<suptype *> *sublist;\
00017   vcl_list<vtol_topology_object*>::const_iterator i;\
00018   for (i=superiors_.begin(); i!=superiors_.end(); ++i)\
00019   {\
00020     sublist=(*i)->target();\
00021     vcl_vector<suptype*>::iterator m_i;\
00022     for (m_i=sublist->begin(); m_i!=sublist->end(); ++m_i)\
00023       new_list->push_back(*m_i);\
00024     delete sublist;\
00025   }\
00026   return tagged_union(new_list)
00027 
00028 #define SEL_INF(inftype,target)\
00029   vcl_vector<inftype *> *new_list=new vcl_vector<inftype *>();\
00030   vcl_vector<inftype *> *sublist;\
00031   for (topology_list::iterator i=inferiors_.begin(); i!=inferiors_.end(); ++i)\
00032   {\
00033     sublist=(*i)->target();\
00034     vcl_vector<inftype *>::iterator m_i;\
00035     for (m_i=sublist->begin(); m_i!=sublist->end(); ++m_i)\
00036       new_list->push_back(*m_i);\
00037     delete sublist;\
00038   }\
00039   return tagged_union(new_list)
00040 
00041 #define SUBCHAIN_INF(listnm, suptype, inftype, target)\
00042   vcl_vector<inftype*> *templist;\
00043   chain_list::iterator hi;\
00044   for (hi=chain_inferiors_.begin(); hi!=chain_inferiors_.end(); ++hi)\
00045   {\
00046     templist = (*hi)->cast_to_##suptype()->target();\
00047     vcl_vector<inftype*>::iterator m_i;\
00048     for (m_i=templist->begin(); m_i!=templist->end(); ++m_i)\
00049       listnm->push_back(*m_i);\
00050     delete templist;\
00051   }\
00052   return tagged_union(listnm)
00053 
00054 #define OUTSIDE_BOUNDARY(targettype, inftype, target)\
00055   vcl_vector<targettype*> *newlist = new vcl_vector<targettype*>();\
00056   vcl_vector<targettype*> *templist;\
00057   for (topology_list::iterator i=inferiors_.begin(); i!=inferiors_.end(); ++i)\
00058   {\
00059     templist = (*i)->cast_to_##inftype()->outside_boundary_##target();\
00060     vcl_vector<targettype*>::iterator m_i;\
00061     for (m_i=templist->begin(); m_i!=templist->end(); ++m_i)\
00062       newlist->push_back(*m_i);\
00063     delete templist;\
00064   }\
00065   return newlist
00066 
00067 #define LIST_SELF(selftype)\
00068   vcl_vector<selftype*> * new_list = new vcl_vector<selftype*>();\
00069   new_list->push_back(this);\
00070   return new_list
00071 
00072 #define COPY_SUP(suptype)\
00073   vcl_vector<suptype*> *new_list = new vcl_vector<suptype*>();\
00074   vcl_list<vtol_topology_object*>::const_iterator i;\
00075   for (i=superiors_.begin(); i!=superiors_.end(); ++i)\
00076     new_list->push_back(static_cast<suptype*>(*i));\
00077   return new_list
00078 
00079 #define COPY_INF(inftype)\
00080   vcl_vector<vtol_##inftype*> *new_list = new vcl_vector<vtol_##inftype*>();\
00081   for (topology_list::iterator i=inferiors_.begin(); i!=inferiors_.end(); ++i)\
00082     new_list->push_back((*i)->cast_to_##inftype());\
00083   return new_list
00084 
00085 #endif // VTOL_MACROS_H