10 #ifndef __SOT_MAILBOX_T_CPP 11 #define __SOT_MAILBOX_T_CPP 21 template <
class Object>
23 : Entity(name), mainObjectMutex(), mainObject(), update(false)
26 SOUT(boost::bind(&
Mailbox::get, this, _1, _2), sotNOSIGNAL,
27 "Mailbox(" + name +
")::output(Object)::sout"),
28 objSOUT(boost::bind(&
Mailbox::getObject, this, _1, _2), SOUT,
29 "Mailbox(" + name +
")::output(Object)::object"),
30 timeSOUT(boost::bind(&
Mailbox::getTimestamp, this, _1, _2), SOUT,
31 "Mailbox(" + name +
")::output(Object)::timestamp") {
33 SOUT.setDependencyType(TimeDependency<int>::BOOL_DEPENDENT);
37 boost::timed_mutex::scoped_lock lockMain(mainObjectMutex);
44 boost::timed_mutex::scoped_try_lock lockMain(this->mainObjectMutex);
46 if (lockMain.owns_lock()) {
54 template <
class Object>
58 boost::timed_mutex::scoped_try_lock lockMain(this->mainObjectMutex);
60 if (lockMain.owns_lock()) {
61 res.
timestamp.tv_sec = this->mainTimeStamp.tv_sec;
62 res.
timestamp.tv_usec = this->mainTimeStamp.tv_usec;
65 res.
obj = this->mainObject;
73 boost::timed_mutex::scoped_lock lockMain(this->mainObjectMutex);
75 gettimeofday(&this->mainTimeStamp, NULL);
82 template <
class Object>
89 template <
class Object>
101 #define MAILBOX_TEMPLATE_SPE(S) \ 102 namespace dynamicgraph { \ 104 template void Mailbox<S>::post(const S &obj); \ 105 template dynamicgraph::Vector &Mailbox<S>::getObject(S &res, \ 107 template bool Mailbox<S>::hasBeenUpdated(void); \ 108 template Mailbox<S>::~Mailbox(); \ 109 template Mailbox<S>::sotTimestampedObject & \ 110 Mailbox<S>::get(Mailbox<S>::sotTimestampedObject &res, const int &dummy); \ 111 template Mailbox<S>::Mailbox(const std::string &name); \ 113 } // namespace sot namespace dynamicgraph 116 #endif // #ifdef __SOT_MAILBOX_T_CPP Mailbox(const std::string &name)
Definition: mailbox.hxx:22
Definition: mailbox.hh:36
dynamicgraph::SignalTimeDependent< struct timeval, int > timeSOUT
Definition: mailbox.hh:70
struct timeval timestamp
Definition: mailbox.hh:38
void post(const Object &obj)
Definition: mailbox.hxx:72
dynamicgraph::SignalTimeDependent< Object, int > objSOUT
Definition: mailbox.hh:69
~Mailbox(void)
Definition: mailbox.hxx:36
sotTimestampedObject & get(sotTimestampedObject &res, const int &dummy)
Definition: mailbox.hxx:56
Definition: mailbox.hh:41
struct timeval & getTimestamp(struct timeval &res, const int &time)
Definition: mailbox.hxx:90
bool hasBeenUpdated(void)
Definition: mailbox.hxx:43
Object obj
Definition: mailbox.hh:37
dynamicgraph::SignalTimeDependent< sotTimestampedObject, int > SOUT
Definition: mailbox.hh:68
Definition: abstract-sot-external-interface.hh:17
Object & getObject(Object &res, const int &time)
Definition: mailbox.hxx:83