39 #ifndef TYPE_DISCOVERY_HPP_ 40 #define TYPE_DISCOVERY_HPP_ 65 #include <boost/version.hpp> 66 #if BOOST_VERSION >= 106400 70 # include <boost/serialization/array_wrapper.hpp> 72 # include <boost/serialization/array.hpp> 74 #include <boost/serialization/serialization.hpp> 75 #include <boost/serialization/is_bitwise_serializable.hpp> 76 #include <boost/serialization/vector.hpp> 77 #include <boost/serialization/string.hpp> 78 #include <boost/archive/detail/iserializer.hpp> 79 #include <boost/archive/detail/oserializer.hpp> 80 #include <boost/archive/archive_exception.hpp> 81 #include <boost/config.hpp> 82 #include <boost/mpl/bool.hpp> 83 #include <boost/array.hpp> 87 #include "../base/DataSourceBase.hpp" 88 #include "../internal/PartDataSource.hpp" 89 #include "../internal/DataSources.hpp" 90 #include "../internal/Reference.hpp" 109 typedef std::vector<base::DataSourceBase::shared_ptr>
Parts;
147 mparent(parent), mref(0)
161 PartNames::iterator it = find( mnames.begin(), mnames.end(), name);
162 if ( it != mnames.end() && mparts.size() == mnames.size() )
163 return mparts.at( it - mnames.begin() );
175 #if BOOST_VERSION >= 104100 176 boost::archive::detail::load_non_pointer_type<type_discovery>::load_only::invoke(*
this,t);
178 boost::archive::detail::load_non_pointer_type<type_discovery,T>::load_only::invoke(*
this,t);
191 if ( ! mparts.empty() )
235 const boost::archive::detail::basic_pointer_iserializer *
243 void load_object(
void *x,
const boost::archive::detail::basic_oserializer & bos)
256 return load_a_type(t, boost::mpl::bool_<boost::serialization::implementation_level<T>::value == boost::serialization::primitive_type>());
303 #if BOOST_VERSION >= 106100 318 template<
class T, std::
size_t N>
345 if ( !membername.empty() ) {
358 mnames.push_back( t.name() );
A DataSource which is used to manipulate a reference to a part of a data source.
type_discovery & load_a_type(const T *&, boost::mpl::false_)
We do not support pointer types.
void load_object(void *x, const boost::archive::detail::basic_oserializer &bos)
Note: not in LoadArchive concept but required when we use archive::load !
internal::Reference * mref
If non-empty, use this reference to the member with name membername.
boost::mpl::bool_< true > is_loading
Saving Archive Concept::is_loading.
virtual void setReference(void *ref)=0
Sets the reference to a given pointer.
type_discovery()
Constructor which only introspects the part names.
Wraps a C array such that we can return a C array from a DataSource.
base::DataSourceBase::shared_ptr getMember(const std::string name)
type_discovery & load_a_type(boost::array< T, N > &t, boost::mpl::false_)
Specialisation that converts a boost::array into a RTT types carray.
type_discovery & operator>>(T &t)
Saving Archive Concept::operator<<.
base::DataSourceBase::shared_ptr discoverMember(T &t, const std::string name)
This function discovers a single part of a serializable struct and returns an assignable datasource t...
PartNames mnames
The names of the parts of the parent struct.
type_discovery & operator&(T &t)
Saving Archive Concept::operator&.
type_discovery & load_a_type(const boost::serialization::array< T > &t, boost::mpl::false_)
Specialisation that converts a boost serialization array into a RTT types carray. ...
void delete_created_pointers()
Loading Archive Concept::delete_created_pointers()
void reset_object_address(const void *new_address, const void *old_address)
Loading Archive Concept::reset_object_address(v,u)
base::DataSourceBase::shared_ptr mparent
The parent struct we're deserializing.
std::vector< std::string > PartNames
std::vector< base::DataSourceBase::shared_ptr > Parts
const boost::archive::detail::basic_pointer_iserializer * register_type(T *=NULL)
Loading Archive Concept::register_type<T>() and ::register_type(u)
Parts mparts
The parts of the parent struct.
type_discovery & load_a_type(T &t, boost::mpl::false_)
Specialisation for writing out composite types (objects).
unsigned int get_library_version()
Loading Archive Concept::get_library_version()
type_discovery & load_a_type(T &t, boost::mpl::true_)
Specialisation for writing out primitive types.
This archive is capable of decomposing objects of serialization level 1 and 2 into part data sources...
Object that may receive a reference to some data by means of a pointer or data source.
boost::intrusive_ptr< DataSourceBase > shared_ptr
Use this type to store a pointer to a DataSourceBase.
Contains TaskContext, Activity, OperationCaller, Operation, Property, InputPort, OutputPort, Attribute.
type_discovery(base::DataSourceBase::shared_ptr parent)
Constructor which inspects part names and creates part data sources.
std::string membername
If non-empty, only discover the member with this name.
bool referenceMember(internal::Reference *ref, T &t, const std::string name)
This function discovers a single part of a serializable struct and sets a reference to that member of...
boost::mpl::bool_< false > is_saving
Saving Archive Concept::is_saving.
type_discovery & load_a_type(const boost::serialization::nvp< T > &t, boost::mpl::false_)
special treatment for name-value pairs.
void discover(T &t)
This function discovers all parts of a serializable struct and creates a DataSource object for each m...