diff --git a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h index 7542aec4c9eb..b84e6a89c118 100644 --- a/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h +++ b/Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h @@ -35,18 +35,18 @@ namespace DataObjects File change history is stored at: Code Documentation is available at: */ + + template class DLLExport VectorColumn : public Column { public: VectorColumn() { - // TODO: implement + m_type = typeName(); } virtual ~VectorColumn() - { - // TODO: implement - } + {} /// Number of individual elements in the column virtual size_t size() const @@ -57,13 +57,13 @@ namespace DataObjects /// Returns typeid for the data in the column virtual const std::type_info& get_type_info() const { - return typeid(int); // TODO: for now + return typeid( std::vector ); } /// Returns typeid for the pointer type to the data element in the column virtual const std::type_info& get_pointer_type_info() const { - return typeid(int); // TODO: for now + return typeid( std::vector* ); } /// Print specified item to the stream @@ -87,13 +87,13 @@ namespace DataObjects /// Overall memory size taken by the column virtual long int sizeOfData() const { - return 0; // TODO: for now + // TODO: implement } /// Create another copy of the column virtual VectorColumn* clone() const { - return NULL; // TODO: for now + // TODO: implement } /// Cast to double @@ -129,22 +129,28 @@ namespace DataObjects /// Pointer to a data element virtual void* void_pointer(size_t index) { - return NULL; + // TODO: implement } /// Pointer to a data element virtual const void* void_pointer(size_t index) const { - return NULL; + // TODO: implement } private: /// All the vectors stored - std::vector< std::vector > m_data; + std::vector< std::vector > m_data; + + /// Returns the name of the column with the given type. Is specialized using DECLARE_VECTORCOLUMN + std::string typeName(); }; } // namespace DataObjects } // namespace Mantid +#define DECLARE_VECTORCOLUMN(Type,TypeName) \ + template<> std::string VectorColumn::typeName() { return #TypeName; }; + #endif /* MANTID_DATAOBJECTS_VECTORCOLUMN_H_ */ diff --git a/Code/Mantid/Framework/DataObjects/src/VectorColumn.cpp b/Code/Mantid/Framework/DataObjects/src/VectorColumn.cpp index c673a7810041..6379392559d8 100644 --- a/Code/Mantid/Framework/DataObjects/src/VectorColumn.cpp +++ b/Code/Mantid/Framework/DataObjects/src/VectorColumn.cpp @@ -4,5 +4,6 @@ namespace Mantid { namespace DataObjects { + DECLARE_VECTORCOLUMN(int, vector_int); } // namespace DataObjects } // namespace Mantid diff --git a/Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h b/Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h index 0fb5ee01d419..f3eab1b84130 100644 --- a/Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h +++ b/Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h @@ -15,14 +15,14 @@ class VectorColumnTest : public CxxTest::TestSuite static VectorColumnTest *createSuite() { return new VectorColumnTest(); } static void destroySuite( VectorColumnTest *suite ) { delete suite; } - - void test_Something() + void test_construction() { - TSM_ASSERT( "You forgot to write a test!", 0); + VectorColumn col; + TS_ASSERT_EQUALS( col.type(), "vector_int"); } }; -#endif /* MANTID_DATAOBJECTS_VECTORCOLUMNTEST_H_ */ \ No newline at end of file +#endif /* MANTID_DATAOBJECTS_VECTORCOLUMNTEST_H_ */