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