Hello, just to give an answer to the list: we discussed it at freenode irc already.
The solution is to use <%param>-scope. But we realized, that it is not documented well enough in the man page ecpp(7). I will add it there. Ivoking the component looks then like that: <& start.layout1 (vec=&vec) &> The invoked part is then: <%def layout1> <%param> std::vector<int> vec; </%param> sizeof vector: <$ vec.size() $> </%def> Note, that the parameterlist is a comma separated list of key value pairs separated with '=', where the value part must be a pointer to the expected type. The type is not checked in the invoked component but just referenced, so you should be really careful, what to pass to the component. It will silently fail, if you pass something else than a pointer to "std::vector<int>". Tommi Am Freitag, 14. Oktober 2011, 21:58:54 schrieb dispy: > Hi, > > is there a convenient way to pass objects, which are _not_ serializable > but copyable to extern (sub)components? > (It was even more elaborated to be able to pass object by reference - > reducing (memory) overhead increases performance. I'm not calling > between different shared libraries, only within one library with > distinct components) > > My current (ugly) solution is as follos: > > caller.ecpp: > <%request scope="global"> > std::vector<int> vec; > </%request> > > <%cpp> > vec.push_back(1); > vec.push_back(2); > </%cpp> > > <& start.layout1 &> > > invoked (different component): > > <%def layout1> > <%request scope="global"> > std::vector<int> vec; > </%request> > > This is Layout 1! Output: <$ vec[0] $> > > </%def> > > This has another disadvantage: As I can gather from the resulting > .cpp-file of caller.ecpp, the vector is always acquired - if I put an > if-clause around the request-variab-definition, it's simply dismissed. > Thus, the program will acquire params for all possible calls (large > project) on every call. This will lead to a performance comparable to > PHP's ;-) > It's not an option to put all subcomponents in the same components (aka > the same file), of course. > > Is there a way to utilize %param (which already serves for complex > objects with copy-ctor) for extern subcomponents? > Or any other method adhering to the classic model of params for functions? > > Regards, > > > > > --------------------------------------------------------------------------- > --- All the data continuously generated in your IT infrastructure contains > a definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Tntnet-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/tntnet-general ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense. http://p.sf.net/sfu/splunk-d2d-oct _______________________________________________ Tntnet-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tntnet-general
