58 utils::
ICLException(
"Unable to assign "+ tDst+
" = "+ tSrc){}
72 ICLQt_API static void assign(
void *src,
const std::string &srcType,
void *dst,
73 const std::string &dstType) ;
94 assign(const_cast<void*>(reinterpret_cast<const void*>(&t)),
95 get_type_name<T>(),
data->data,
data->type);
102 inline T
as()
const {
104 assign(
data->data,
data->type,&t,get_type_name<T>());
120 *
this =
Event(
"render");
143 *
this =
Event(
"register",cb);
148 *
this =
Event(
"register-complex",cb);
153 *
this =
Event(
"enable");
158 *
this =
Event(
"disable");
203 Data operator[](
const std::string &key) ;
210 std::vector<T>
collect(
const std::vector<std::string> &keys){
211 std::vector<T> v(keys.size());
212 for(
unsigned int i=0;i<keys.size();++i) v[i] =
operator[](keys[i]);
217 static void list_possible_assignments(
const std::string &srcType,
const std::string &dstType);
222 Assign(
const std::string &srcType,
const std::string &dstType,
223 const std::string &srcRTTI,
const std::string &dstRTTI):
224 srcType(srcType),dstType(dstType),srcRTTI(srcRTTI),dstRTTI(dstRTTI){}
226 virtual bool operator()(
void *src,
void *dst){
return false; }
233 static void register_assignment_rule(Assign *assign);
240 template<
class SRC,
class DST>
242 const std::string &dstTypeName,
244 struct TypeDependentAssign :
public Assign{
246 TypeDependentAssign(
const std::string &srcTypeName,
const std::string &dstTypeName,
248 Assign(srcTypeName, dstType, get_type_name<SRC>(), get_type_name<DST>()),assign(assign){}
250 virtual bool operator()(
void *src,
void *dst){
251 assign( *(
const SRC*)src, *(DST*)dst );
255 register_assignment_rule(
new TypeDependentAssign(srcTypeName,dstTypeName,assign));
261 template<
class SRC,
class DST>
263 const std::string &dstTypeName){
264 struct TypeDependentTrivialAssign :
public Assign{
265 TypeDependentTrivialAssign(
const std::string &srcTypeName,
const std::string &dstTypeName):
266 Assign(srcTypeName, dstTypeName, get_type_name<SRC>(), get_type_name<DST>()){}
268 virtual bool operator()(
void *src,
void *dst){
269 *(DST*)dst = *(
const SRC*)src;
273 register_assignment_rule(
new TypeDependentTrivialAssign(srcTypeName,dstTypeName));
Extension of the associative container MultiTypeMap.
Definition: DataStore.h:47
utils::Function< void > cb
Definition: DataStore.h:84
void operator=(const T &t)
Trys to assign an instance of T to this Data-Element.
Definition: DataStore.h:93
std::string message
Definition: DataStore.h:82
UnassignableTypesException(const std::string &tSrc, const std::string &tDst)
Definition: DataStore.h:57
undocument this line if you encounter any issues!
Definition: Any.h:37
void link(void *data)
links DrawWidget3D and GLCallback
Definition: DataStore.h:124
void registerCallback(const utils::Function< void, const std::string & > &cb)
register simple callback type
Definition: DataStore.h:147
Abstract and associative Data Container for Data of different types.
Definition: MultiTypeMap.h:67
Internal Exception type thrown if Data::operator= is called for incompatible values.
Definition: DataStore.h:56
std::string srcType
Definition: DataStore.h:221
virtual bool operator()(void *src, void *dst)
Definition: DataStore.h:226
std::vector< T > collect(const std::vector< std::string > &keys)
convenience function that allows collecting data from different source entries
Definition: DataStore.h:210
void registerCallback(const utils::Function< void > &cb)
register simple callback type
Definition: DataStore.h:142
internally used assignment structure
Definition: DataStore.h:220
Event(const std::string &msg, const utils::Function< void > &cb)
Definition: DataStore.h:80
static void register_assignment_rule(const std::string &srcTypeName, const std::string &dstTypeName, utils::Function< void, const SRC &, DST & > assign)
registers a new assignment rule to the DataStore class
Definition: DataStore.h:241
ICLQt_API ImgROI data(ImgQ &r)
creates full ROI ROI-struct
internally used data handling structure
Definition: MultiTypeMap.h:241
Internally used Data- Structure.
Definition: DataStore.h:78
void * data
Definition: DataStore.h:83
DataArray * data
internally reference DataStore entry
Definition: DataStore.h:66
static void register_trivial_assignment_rule(const std::string &srcTypeName, const std::string &dstTypeName)
registers trivial assignment rule to the DataStore class
Definition: DataStore.h:262
T as() const
Trys to convert a Data element into a (by template parameter) given type.
Definition: DataStore.h:102
const std::string & getTypeID() const
returns the internal type ID (obtained by C++'s RTTI)
Definition: DataStore.h:115
#define ICLQt_API
Definition: CompatMacros.h:178
Arbitrary Data encapsulation type.
Definition: DataStore.h:63
Base class for Exception handling in the ICL.
Definition: Exception.h:42
Event(const std::string &msg, const utils::Function< void, const std::string & > &cb2)
Definition: DataStore.h:81
Internal Exception type thrown if operator[] is given an unknown index string.
Definition: DataStore.h:51
void install(void *data)
data must be of type MouseHandler*
Definition: DataStore.h:129
Event(const std::string &msg="", void *data=0)
Definition: DataStore.h:79
Data(DataArray *data)
Constructor (private->only the parent DataStore is allowed to contruct Data's)
Definition: DataStore.h:69
Assign(const std::string &srcType, const std::string &dstType, const std::string &srcRTTI, const std::string &dstRTTI)
Definition: DataStore.h:222
void disable()
possible for all handle types
Definition: DataStore.h:157
void enable()
possible for all handle-types
Definition: DataStore.h:152
utils::Function< void, const std::string & > cb2
Definition: DataStore.h:85
KeyNotFoundException(const std::string &key)
Definition: DataStore.h:52
void render()
Definition: DataStore.h:119