OpenWalnut  1.3.1
WDataSet.cpp
1 //---------------------------------------------------------------------------
2 //
3 // Project: OpenWalnut ( http://www.openwalnut.org )
4 //
5 // Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6 // For more information see http://www.openwalnut.org/copying
7 //
8 // This file is part of OpenWalnut.
9 //
10 // OpenWalnut is free software: you can redistribute it and/or modify
11 // it under the terms of the GNU Lesser General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // OpenWalnut is distributed in the hope that it will be useful,
16 // but WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 // GNU Lesser General Public License for more details.
19 //
20 // You should have received a copy of the GNU Lesser General Public License
21 // along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22 //
23 //---------------------------------------------------------------------------
24 
25 #include <string>
26 
27 #include "../common/WAssert.h"
28 #include "../common/WCondition.h"
29 #include "../common/WTransferable.h"
30 #include "exceptions/WDHException.h"
31 #include "WDataSet.h"
32 #include "WDataSetVector.h"
33 #include "WDataTexture3D.h"
34 
35 // prototype instance as singleton
36 boost::shared_ptr< WPrototyped > WDataSet::m_prototype = boost::shared_ptr< WPrototyped >();
37 
39  : WTransferable(),
40  m_properties( boost::shared_ptr< WProperties >( new WProperties( "Data-Set Properties", "Properties of a data-set" ) ) ),
41  m_infoProperties( boost::shared_ptr< WProperties >( new WProperties( "Data-Set Info Properties", "Data-set's information properties" ) ) ),
42  m_filename( "" )
43 {
44  m_infoProperties->setPurpose( PV_PURPOSE_INFORMATION );
45 }
46 
47 void WDataSet::setFileName( const std::string filename )
48 {
49  setFilename( filename );
50 }
51 
52 std::string WDataSet::getFileName() const
53 {
54  return getFilename();
55 }
56 
57 void WDataSet::setFilename( const std::string filename )
58 {
59  WAssert( filename != "", "No filename set for data set." );
60  m_filename = filename;
61 }
62 
63 std::string WDataSet::getFilename() const
64 {
65  return m_filename;
66 }
67 
68 bool WDataSet::isTexture() const
69 {
70  return false;
71 }
72 
73 osg::ref_ptr< WDataTexture3D > WDataSet::getTexture() const
74 {
75  throw WDHException( std::string( "This dataset does not provide a texture." ) );
76 }
77 
78 const std::string WDataSet::getName() const
79 {
80  return "WDataSet";
81 }
82 
83 const std::string WDataSet::getDescription() const
84 {
85  return "Encapsulates the whole common feature set of all datasets.";
86 }
87 
88 boost::shared_ptr< WPrototyped > WDataSet::getPrototype()
89 {
90  if( !m_prototype )
91  {
92  m_prototype = boost::shared_ptr< WPrototyped >( new WDataSet() );
93  }
94 
95  return m_prototype;
96 }
97 
98 boost::shared_ptr< WDataSetVector > WDataSet::isVectorDataSet()
99 {
100  return boost::shared_ptr< WDataSetVector >();
101 }
102 
103 boost::shared_ptr< WProperties > WDataSet::getProperties() const
104 {
105  return m_properties;
106 }
107 
108 boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const
109 {
110  return m_infoProperties;
111 }
112