Orocos Real-Time Toolkit  2.9.0
DataObjectBase.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * This library is free software; you can redistribute it and/or *
3  * modify it under the terms of the GNU General Public *
4  * License as published by the Free Software Foundation; *
5  * version 2 of the License. *
6  * *
7  * As a special exception, you may use this file as part of a free *
8  * software library without restriction. Specifically, if other files *
9  * instantiate templates or use macros or inline functions from this *
10  * file, or you compile this file and link it with other files to *
11  * produce an executable, this file does not by itself cause the *
12  * resulting executable to be covered by the GNU General Public *
13  * License. This exception does not however invalidate any other *
14  * reasons why the executable file might be covered by the GNU General *
15  * Public License. *
16  * *
17  * This library is distributed in the hope that it will be useful, *
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
20  * Lesser General Public License for more details. *
21  * *
22  * You should have received a copy of the GNU General Public *
23  * License along with this library; if not, write to the Free Software *
24  * Foundation, Inc., 59 Temple Place, *
25  * Suite 330, Boston, MA 02111-1307 USA *
26  * *
27  ***************************************************************************/
28 
29 
30 #include "DataObjectBase.hpp"
31 #include "../ConnPolicy.hpp"
32 
33 using namespace RTT;
34 using namespace RTT::base;
35 
37  : max_threads_(2)
38  , multiple_writers_(false)
39  , multiple_readers_(false)
40 {}
41 
43  : max_threads_(max_threads)
44  , multiple_writers_(false)
45  , multiple_readers_(true)
46 {}
47 
49  : max_threads_(2)
50  , multiple_writers_(policy.buffer_policy == PerInputPort || policy.buffer_policy == Shared)
51  , multiple_readers_(policy.buffer_policy == PerOutputPort || policy.buffer_policy == Shared)
52 {
53  if (policy.max_threads == 0) {
54  if (multiple_writers_) {
55  max_threads_ += 10;
56  }
57  if (multiple_readers_) {
58  max_threads_ += 10;
59  }
60  } else {
61  max_threads_ = policy.max_threads;
62  }
63 }
A connection policy object describes how a given connection should behave.
Definition: ConnPolicy.hpp:107
int max_threads
The maximum number of threads that will access the connection data or buffer object.
Definition: ConnPolicy.hpp:224
Base classes of RTT classes.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
Definition: Activity.cpp:52