IMP logo
IMP Reference Guide  2.22.0
The Integrative Modeling Platform
IMP::example::ExampleTemplateClassD< D > Class Template Reference

A line segment templated on the dimension. More...

#include <IMP/example/ExampleTemplateClass.h>

Detailed Description

template<unsigned int D>
class IMP::example::ExampleTemplateClassD< D >

A line segment templated on the dimension.

Like the underlying algebra::VectorD data, is not initialized when the default constructor is used. Since it is a small class, it is designed to be allocated on the stack and to be passed by value (or const &).

The class should be named SegmentD, but it is a demonstration.

The source code is as follows:

/**
* \file IMP/example/ExampleTemplateClass.h
* \brief Show how to manage a template class with Python.
*
* Copyright 2007-2022 IMP Inventors. All rights reserved.
*
*/
#ifndef IMPEXAMPLE_EXAMPLE_TEMPLATE_CLASS_H
#define IMPEXAMPLE_EXAMPLE_TEMPLATE_CLASS_H
#include <IMP/example/example_config.h>
#include <IMP/utility.h>
IMPEXAMPLE_BEGIN_NAMESPACE
//! A line segment templated on the dimension.
/** Like the underlying
algebra::VectorD data, is not initialized when the default
constructor is used. Since it is a small class, it is designed to
be allocated on the stack and to be passed by value (or
const &).
The class should be named SegmentD, but it is a demonstration.
The source code is as follows:
\include ExampleTemplateClass.h
*/
template <unsigned int D>
class ExampleTemplateClassD {
public:
ExampleTemplateClassD() {}
/** Since it is a simple object, there is no reason to provide
methods to change the data.
*/
ExampleTemplateClassD(const IMP::algebra::VectorD<D> &a,
eps_[0] = a;
eps_[1] = b;
}
//! Get one of the endpoints
const IMP::algebra::VectorD<D> &get_point(unsigned int i) const {
IMP_USAGE_CHECK(i < 2, "The endpoint index can only be 0 or 1");
return eps_[i];
}
IMP_SHOWABLE_INLINE(ExampleTemplateClassD, out << eps_[0] << " " << eps_[1];);
};
typedef ExampleTemplateClassD<3> ExampleTemplateClass3D;
typedef Vector<ExampleTemplateClassD<3> > ExampleTemplateClass3Ds;
IMPEXAMPLE_END_NAMESPACE
#endif /* IMPEXAMPLE_EXAMPLE_TEMPLATE_CLASS_H */

Definition at line 32 of file ExampleTemplateClass.h.

Public Member Functions

 ExampleTemplateClassD (const IMP::algebra::VectorD< D > &a, const IMP::algebra::VectorD< D > &b)
 
const IMP::algebra::VectorD< D > & get_point (unsigned int i) const
 Get one of the endpoints. More...
 
void show (std::ostream &out=std::cout) const
 

Constructor & Destructor Documentation

template<unsigned int D>
IMP::example::ExampleTemplateClassD< D >::ExampleTemplateClassD ( const IMP::algebra::VectorD< D > &  a,
const IMP::algebra::VectorD< D > &  b 
)

Since it is a simple object, there is no reason to provide methods to change the data.

Definition at line 40 of file ExampleTemplateClass.h.

Member Function Documentation

template<unsigned int D>
const IMP::algebra::VectorD<D>& IMP::example::ExampleTemplateClassD< D >::get_point ( unsigned int  i) const

Get one of the endpoints.

Definition at line 46 of file ExampleTemplateClass.h.


The documentation for this class was generated from the following file: