IMP  2.0.1
The Integrative Modeling Platform
DataObject.h
Go to the documentation of this file.
1 /**
2  * \file IMP/core/DataObject.h
3  * \brief A modifier which variables within a ball.
4  *
5  * Copyright 2007-2013 IMP Inventors. All rights reserved.
6  *
7  */
8 
9 #ifndef IMPCORE_DATA_OBJECT_H
10 #define IMPCORE_DATA_OBJECT_H
11 
12 #include <IMP/core/core_config.h>
13 #include <IMP/Object.h>
14 
15 IMPCORE_BEGIN_NAMESPACE
16 
17 /** This is a helper class for creating an IMP object storing some data. This
18  can be used to, eg, add the data to a particle as part of a cache.
19 
20  This class is C++ only.
21  */
22 template <class Data>
24 {
25  Data data_;
26 public:
27  DataObject(const Data &d, std::string name="DataObject %1%"):Object(name),
28  data_(d){
29  }
30  const Data &get_data() const {return data_;}
31  Data &access_data() {return data_;}
33 };
34 #if !defined(IMP_DOXYGEN) && !defined(SWIG)
35 template <class Data>
36 inline void DataObject<Data>::do_show(std::ostream &out) const {
37  IMP_UNUSED(out);
38 }
39 #endif
40 
41 IMPCORE_END_NAMESPACE
42 
43 #endif /* IMPCORE_DATA_OBJECT_H */