Skip to content

Commit

Permalink
Refs #8534. Initial files for new VectorColumn class.
Browse files Browse the repository at this point in the history
  • Loading branch information
arturbekasov committed Dec 4, 2013
1 parent f9d6e70 commit 68619d6
Show file tree
Hide file tree
Showing 4 changed files with 190 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Code/Mantid/Framework/DataObjects/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ set ( SRC_FILES
src/SplittersWorkspace.cpp
src/TableColumn.cpp
src/TableWorkspace.cpp
src/VectorColumn.cpp
src/Workspace2D.cpp
src/WorkspaceSingleValue.cpp
)
Expand Down Expand Up @@ -57,16 +58,17 @@ set ( INC_FILES
inc/MantidDataObjects/SplittersWorkspace.h
inc/MantidDataObjects/TableColumn.h
inc/MantidDataObjects/TableWorkspace.h
inc/MantidDataObjects/VectorColumn.h
inc/MantidDataObjects/Workspace2D.h
inc/MantidDataObjects/WorkspaceSingleValue.h
)

set ( TEST_FILES
CompressedWorkspace2DTest.h
EventListTest.h
EventsTest.h
EventWorkspaceMRUTest.h
EventWorkspaceTest.h
EventsTest.h
GroupingWorkspaceTest.h
Histogram1DTest.h
LibraryManagerTest.h
Expand All @@ -86,6 +88,7 @@ set ( TEST_FILES
TableWorkspacePropertyTest.h
TableWorkspaceTest.h
TofEventTest.h
VectorColumnTest.h
WeightedEventNoTimeTest.h
WeightedEventTest.h
Workspace2DTest.h
Expand Down
150 changes: 150 additions & 0 deletions Code/Mantid/Framework/DataObjects/inc/MantidDataObjects/VectorColumn.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
#ifndef MANTID_DATAOBJECTS_VECTORCOLUMN_H_
#define MANTID_DATAOBJECTS_VECTORCOLUMN_H_

#include "MantidAPI/Column.h"
#include "MantidKernel/System.h"


namespace Mantid
{
namespace DataObjects
{

using namespace Kernel;
using namespace API;

/** VectorColumn : TODO: DESCRIPTION
Copyright © 2013 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge National Laboratory
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class DLLExport VectorColumn : public Column
{
public:
VectorColumn()
{
// TODO: implement
}

virtual ~VectorColumn()
{
// TODO: implement
}

/// Number of individual elements in the column
virtual size_t size() const
{
return m_data.size();
}

/// Returns typeid for the data in the column
virtual const std::type_info& get_type_info() const
{
return typeid(int); // TODO: for now
}

/// 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
}

/// Print specified item to the stream
virtual void print(size_t index, std::ostream& s) const
{
// TODO: implement
}

/// Set item from a string value
virtual void read(size_t index, const std::string & text)
{
// TODO: implement
}

/// Specialized type check
virtual bool isBool() const
{
return false;
}

/// Overall memory size taken by the column
virtual long int sizeOfData() const
{
return 0; // TODO: for now
}

/// Create another copy of the column
virtual VectorColumn* clone() const
{
return NULL; // TODO: for now
}

/// Cast to double
virtual double toDouble(size_t i) const
{
throw std::runtime_error("VectorColumn is not convertible to double.");
}

/// Assign from double
virtual void fromDouble(size_t i, double value)
{
throw std::runtime_error("VectorColumn is not assignable from double.");
}

protected:
/// Sets the new column size.
virtual void resize(size_t count)
{
// TODO: implement
}

/// Inserts an item.
virtual void insert(size_t index)
{
// TODO: implement
}

/// Removes an item.
virtual void remove(size_t index)
{
}

/// Pointer to a data element
virtual void* void_pointer(size_t index)
{
return NULL;
}

/// Pointer to a data element
virtual const void* void_pointer(size_t index) const
{
return NULL;
}

private:
/// All the vectors stored
std::vector< std::vector<int> > m_data;
};


} // namespace DataObjects
} // namespace Mantid

#endif /* MANTID_DATAOBJECTS_VECTORCOLUMN_H_ */
8 changes: 8 additions & 0 deletions Code/Mantid/Framework/DataObjects/src/VectorColumn.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "MantidDataObjects/VectorColumn.h"

namespace Mantid
{
namespace DataObjects
{
} // namespace DataObjects
} // namespace Mantid
28 changes: 28 additions & 0 deletions Code/Mantid/Framework/DataObjects/test/VectorColumnTest.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef MANTID_DATAOBJECTS_VECTORCOLUMNTEST_H_
#define MANTID_DATAOBJECTS_VECTORCOLUMNTEST_H_

#include <cxxtest/TestSuite.h>

#include "MantidDataObjects/VectorColumn.h"

using Mantid::DataObjects::VectorColumn;

class VectorColumnTest : public CxxTest::TestSuite
{
public:
// This pair of boilerplate methods prevent the suite being created statically
// This means the constructor isn't called when running other tests
static VectorColumnTest *createSuite() { return new VectorColumnTest(); }
static void destroySuite( VectorColumnTest *suite ) { delete suite; }


void test_Something()
{
TSM_ASSERT( "You forgot to write a test!", 0);
}


};


#endif /* MANTID_DATAOBJECTS_VECTORCOLUMNTEST_H_ */

0 comments on commit 68619d6

Please sign in to comment.