00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "proc/asset/procpatt.hpp"
00025 #include "proc/asset/proc.hpp"
00026 #include "proc/assetmanager.hpp"
00027 #include "proc/asset/buildinstruct.hpp"
00028 #include "common/util.hpp"
00029
00030 using util::isnil;
00031
00032 namespace asset
00033 {
00034
00035
00041 ProcPatt::ProcPatt (const Asset::Ident& idi)
00042 : Struct (idi),
00043 instructions_()
00044 { }
00045
00046
00048 ProcPatt::ProcPatt (const Asset::Ident& idi, const InstructionSequence& instru)
00049 : Struct (idi),
00050 instructions_(instru)
00051 {
00052 TODO ("verify building instructions, maybe preprocess...");
00053 }
00054
00055
00056
00063 P<ProcPatt>
00064 ProcPatt::newCopy (string newID) const
00065 {
00066 TODO ("implement the Pattern-ID within the propDescriptor!");
00067 TODO ("implement a consitent struct asset naming scheme at one central location!!!!!");
00068 const Asset::Ident newIdi ( this->ident.name+".X"
00069 , this->ident.category
00070 );
00071 ProcPatt* pP = new ProcPatt (newIdi, this->instructions_);
00072 return AssetManager::instance().wrap (*pP);
00073 }
00074
00075
00080 ProcPatt&
00081 ProcPatt::attach(Symbol where, PProc& node)
00082 {
00083 DoAttach *last (0);
00084 if ( !isnil (instructions_)
00085 && (last = boost::get<DoAttach> (&(instructions_.back())))
00086 && last->point==where
00087 )
00088
00089
00090 last->nodes.push_back(node);
00091 else
00092 {
00093 DoAttach entry(node, where);
00094 BuildInstruct instruction(entry);
00095 instructions_.push_back(instruction);
00096 }
00097 TODO ("declare dependency??");
00098 return *this;
00099 }
00100
00101
00107 ProcPatt&
00108 ProcPatt::operator+= (PProcPatt& toReuse)
00109 {
00110 DoRecurse entry(toReuse);
00111 instructions_.push_back(BuildInstruct (entry));
00112 TODO ("declare dependency??");
00113
00114 return *this;
00115 }
00116
00117
00118
00119
00120 }