test_mailbox.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2010,
3  * François Bleibel,
4  * Olivier Stasse,
5  *
6  * CNRS/AIST
7  *
8  */
9 
10 #include <iostream>
11 #include <sot/core/debug.hh>
12 
13 #ifndef WIN32
14 #include <unistd.h>
15 #endif
16 
17 using namespace std;
18 
19 #include <dynamic-graph/entity.h>
20 #include <dynamic-graph/factory.h>
21 
24 #include <sstream>
25 
26 using namespace dynamicgraph;
27 using namespace dynamicgraph::sot;
28 
29 #include <boost/thread.hpp>
30 
32 
33 void f(void) {
34  Vector vect(25);
35  Vector vect2(25);
36  for (int i = 0; i < 250; ++i) {
37  std::cout << " iter " << i << std::endl;
38  for (int j = 0; j < 25; ++j) vect(j) = j + i * 10;
39  mailbox->post(vect);
40  Vector V = mailbox->getObject(vect2, 1);
41  std::cout << vect2 << std::endl;
42  std::cout << " getClassName " << mailbox->getClassName() << std::endl;
43  std::cout << " getName " << mailbox->getName() << std::endl;
44  std::cout << " hasBeenUpdated " << mailbox->hasBeenUpdated() << std::endl;
45  std::cout << std::endl;
46  }
47 }
48 
49 int main(int, char **) {
50  mailbox = new sot::MailboxVector("mail");
51 
52  boost::thread th(f);
53  th.join();
54 
55  return 0;
56 }
V
Eigen::VectorXd Vector
sot::MailboxVector * mailbox
int i
virtual const std::string & getClassName(void) const
Definition: mailbox.hh:46
void post(const Object &obj)
Object & getObject(Object &res, const int &time)
void f(void)
int main(int, char **)
Mailbox< dynamicgraph::Vector > MailboxVector
const std::string & getName() const


sot-core
Author(s): Olivier Stasse, ostasse@laas.fr
autogenerated on Wed Jun 21 2023 02:51:26