IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
StaticParameterSplit.h
1 // StaticParameterSplit.h:
3 // -----------------------
4 //
15 
16 #ifndef __IPSDKBASEPROCESSING_STATICPARAMETERSPLIT_H__
17 #define __IPSDKBASEPROCESSING_STATICPARAMETERSPLIT_H__
18 
19 #include <IPSDKBaseProcessing/DataSplit/Static/BaseStaticSplit.h>
20 #include <boost/make_shared.hpp>
21 
22 namespace ipsdk {
23 namespace processor {
24 
27 
28 template <typename TProcessor, typename TAttribute>
30 {
31 // predefined public types
32 public:
34  typedef TProcessor ProcessorType;
35 
37  typedef TAttribute AttributeType;
38 
40  typedef typename TAttribute::StorageType ParameterType;
41 
43  typedef std::vector<ParameterType> ParameterColl;
44 
46  typedef boost::shared_ptr<const ParameterColl> ParameterCollConstPtr;
47 
48 public:
54 
55 // methods
56 public:
59 
61  const std::string& getAttributeName() const;
62 
64  const std::string& getAttributeToolTip() const;
65 
67  void init(const ParameterCollConstPtr& pParameterColl);
68 
69 protected:
71  bool checkProcessorType(const BaseProcessor& processor);
72 
77  const ipUInt32 elementIdx,
78  const core::BaseRequestOrigin& requestOrigin);
79 
80 // attributes
81 protected:
84 };
85 
88 
89 template <typename TProcessor, typename TAttribute>
91 {
92 
93 }
94 
95 template <typename TProcessor, typename TAttribute>
96 StaticParameterSplit<TProcessor, TAttribute>::~StaticParameterSplit()
97 {
98 
99 }
100 
101 template <typename TProcessor, typename TAttribute>
102 inline eSplitStaticType
104 {
106 }
107 
108 template <typename TProcessor, typename TAttribute>
109 inline const std::string&
111 {
112  return TAttribute::getObjectNameStr();
113 }
114 
115 template <typename TProcessor, typename TAttribute>
116 inline const std::string&
118 {
119  return TAttribute::getToolTipStr();
120 }
121 
122 template <typename TProcessor, typename TAttribute>
123 inline void
125 {
126  // check for input shared pointer validity
127  if (pParameterColl.get() == 0)
128  throwNullInputSharedPtr();
129 
130  // retrieve associated number of parameters
131  const ipUInt32 nbParams = static_cast<ipUInt32>(pParameterColl->size());
132 
133  // call of base class initialization method
134  ElementsLocationInfo elementsLocationInfo;
135  elementsLocationInfo.insertNonLocalized(ElementsRange(0, nbParams), 0);
136  this->initBaseSplitted(elementsLocationInfo);
137 
138  // collection of elements associated to static split
139  _pParameterColl = pParameterColl;
140 }
141 
142 template <typename TProcessor, typename TAttribute>
143 inline bool
145 {
146  // check for consistency between processor and attribute
148  "This attribute is not part of processor class");
149 
150  return dynamic_cast<const TProcessor*>(&processor) != 0;
151 }
152 
153 template <typename TProcessor, typename TAttribute>
154 inline BoolResult
156  const ipUInt32 elementIdx,
157  const core::BaseRequestOrigin& requestOrigin)
158 {
159  // cast of input processor object
160  TProcessor& tProcessor = static_cast<TProcessor&>(processor);
161 
162  // update of processor attribute value
163  tProcessor.TProcessor::template set<TAttribute>((*_pParameterColl)[elementIdx]);
164 
165  return true;
166 }
167 
170 
171 } // end of namespace processor
172 } // end of namespace ipsdk
173 
174 #endif // __IPSDKBASEPROCESSING_STATICPARAMETERSPLIT_H__
Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
TProcessor ProcessorType
processor type associated to object
Definition: StaticParameterSplit.h:34
ipUInt64 insertNonLocalized(const ElementsRange &elementsRange, const ipUInt64 dataMemorySize)
insertion of a new non localized information into collection
bool checkProcessorType(const BaseProcessor &processor)
check processor type in derived class
Definition: StaticParameterSplit.h:144
Base class for processor class.
Definition: BaseProcessor.h:43
structure allowing to check whether a given attribute exists in attribute collection information ...
Definition: AttributeCollInfoCheckMacros.h:131
eSplitStaticType
Enumerate describing static split operation type.
Definition: StaticSplitTypes.h:32
Base class for data static split objets used for data dispatch.
Definition: BaseStaticSplit.h:34
Static split operation type for algorithm parameters.
Definition: StaticSplitTypes.h:38
std::vector< ParameterType > ParameterColl
collection of elements associated to static split
Definition: StaticParameterSplit.h:43
Class allowing to store information about elements range (start offset and number of elements) ...
Definition: ElementsRange.h:27
const std::string & getAttributeToolTip() const
retrieve attribute tooltip associated to split operation
Definition: StaticParameterSplit.h:117
Base class for request origin description.
Definition: BaseRequestOrigin.h:28
eSplitStaticType getSplitStaticType() const
retrieve static split operation type
Definition: StaticParameterSplit.h:103
const std::string & getAttributeName() const
retrieve attribute name associated to split operation
Definition: StaticParameterSplit.h:110
Template class for parameter splitted data used for static data dispatch.
Definition: StaticParameterSplit.h:29
TAttribute::StorageType ParameterType
parameter type associated to object
Definition: StaticParameterSplit.h:40
ParameterCollConstPtr _pParameterColl
collection of elements associated to static split
Definition: StaticParameterSplit.h:83
Class allowing to store elements location informations.
Definition: ElementsLocationInfo.h:32
BoolResult processAttribute(BaseProcessor &processor, const ipUInt32 elementIdx, const core::BaseRequestOrigin &requestOrigin)
initialize processor attribute associate to split operation for a given element index ...
Definition: StaticParameterSplit.h:155
TAttribute AttributeType
attribute type associated to object
Definition: StaticParameterSplit.h:37
boost::shared_ptr< const ParameterColl > ParameterCollConstPtr
shared pointer to collection of elements associated to static split
Definition: StaticParameterSplit.h:46
void init(const ParameterCollConstPtr &pParameterColl)
object initialization method
Definition: StaticParameterSplit.h:124
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53