Only IMP::Pointer objects should be used to store pointers to instances of these objects.
The source code is as follows:
#ifndef IMPEXAMPLE_EXAMPLE_REF_COUNTED_H
#define IMPEXAMPLE_EXAMPLE_REF_COUNTED_H
#include <IMP/example/example_config.h>
#include <vector>
IMPEXAMPLE_BEGIN_NAMESPACE
class IMPEXAMPLEEXPORT ExampleRefCounted: public base::RefCounted
{
public:
ExampleRefCounted(
const Floats &data);
double get_data(unsigned int i) const {
<< " out of range.");
return data_[i];
}
};
typedef base::Vector<Pointer<ExampleRefCounted> > ExampleRefCounteds;
typedef base::Vector<WeakPointer<ExampleRefCounted> > ExampleRefCountedsTemp;
IMPEXAMPLE_END_NAMESPACE
#endif
IMPEXAMPLE_BEGIN_NAMESPACE
ExampleRefCounted::ExampleRefCounted(
const Floats &data ):
data_(data){
}
namespace {
#ifdef __clang__
IMP_CLANG_PRAGMA(diagnostic ignored "-Wunused-function")
#endif
void usage_example() {
IMP_NEW(ExampleRefCounted, rc, (data));
Pointer<ExampleRefCounted> rc_other= new ExampleRefCounted(data);
Pointer<ExampleRefCounted> rc2=rc;
rc=static_cast<ExampleRefCounted*>(nullptr);
std::cout << rc2->get_data(100);
}
}
IMPEXAMPLE_END_NAMESPACE
Definition at line 30 of file ExampleRefCounted.h.