43 #include "../TaskContext.hpp" 45 #include "../internal/GlobalService.hpp" 47 #include <boost/bind.hpp> 48 #include <boost/iterator/iterator_traits.hpp> 53 using namespace detail;
55 using namespace boost;
59 int length = advance_on_error;
61 while (advance_on_error != 0) {
67 return error_status<>( error_status<>::accept, length );
77 while ( callqueue.size() > 0 && _peer->hasPeer( callqueue.front() ) ) {
79 _peer = _peer->getPeer( callqueue.front() );
81 if ( _peer->ready() == false ) {
83 (
"Attempt to use TaskContext "+ callqueue.front() +
" which is not ready to use." );
90 if ( !callqueue.empty() ) {
91 std::string name = callqueue.front();
92 if ( (name ==
"states" || name ==
"programs") && _peer->provides()->hasService(name) == 0) {
93 log(
Warning) <<
"'"<<name<<
"' peer not found. The use of '"<<name<<
"' has been deprecated."<<
endlog();
94 log(
Warning) <<
"Modify your script to use the program's or state machine's name directly."<<
endlog();
99 mcurobject = _peer->provides();
102 while ( callqueue.size() > 0 && mcurobject->hasService( callqueue.front() ) ) {
104 mcurobject = mcurobject->provides( callqueue.front() );
105 mlastobject = callqueue.front();
110 if (mcurobject == context->provides() && callqueue.size() != 0 ) {
112 while ( callqueue.size() && mcurobject->hasService( callqueue.front() ) ) {
113 mcurobject = mcurobject->provides( callqueue.front() );
114 mlastobject = callqueue.front();
120 if ( mfullpath && callqueue.size() != 0 ) {
122 string object = callqueue.front();
123 while ( !callqueue.empty() )
126 if ( _peer->provides() == mcurobject )
127 throw_(begin,
"From TaskContext '"+context->getName()+
"': Task '"+ _peer->getName()+
"' has no child Service '"+
object+
"'." );
129 throw_(begin,
"From TaskContext '"+context->getName()+
"': Service '"+ mcurobject->getName()+
"' has no child Service '"+
object+
"'." );
135 : commonparser(cp), mcurobject(c->provides()), mlastobject(
"this"), context(c), _peer(context), mfullpath(fullpath), mfoundpath(false), advance_on_error(0)
137 BOOST_SPIRIT_DEBUG_RULE(
my_guard );
138 BOOST_SPIRIT_DEBUG_RULE(
peerpath );
164 std::string name( begin, end );
165 name.erase( name.length() -1 );
172 std::string name( begin, end );
173 name.erase( name.length() -1 );
179 (
"Attempt to use TaskContext "+name+
" which is not ready to use." );
196 if ( name ==
"states" || name ==
"programs") {
197 log(
Warning) <<
"'"<<name<<
"' peer not found. The use of '"<<name<<
"' has been deprecated."<<
endlog();
198 log(
Warning) <<
"Modify your script to use the program's or state machine's name directly."<<
endlog();
RTT_HIDE void locatepeer(iter_t begin, iter_t end)
PeerParser(TaskContext *c, CommonParser &cp, bool fullpath=false)
Service::shared_ptr provides()
RTT_HIDE error_status handle_no_peer(scanner_t const &scan, parser_error< PeerErrors, iter_t > &e)
boost::iterator_difference< iter_t >::type advance_on_error
RTT_HIDE void seenobjectname(iter_t begin, iter_t end)
This class contains some very common parser definitions.
virtual TaskContext * getPeer(const std::string &peer_name) const
boost::shared_ptr< Service > shared_ptr
virtual bool hasPeer(const std::string &peer_name) const
scanner< iter_t, scanner_pol_t > scanner_t
std::queue< std::string > callqueue
guard< PeerErrors > my_guard
rule_t notassertingidentifier
identifier with <template> marks in it
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
static Logger::LogFunction endlog()
static RTT_API Service::shared_ptr Instance()
CommonParser & commonparser