OpenWalnut  1.2.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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  WAssert( fileName != "", "No filename set for data set." );
50  m_fileName = fileName;
51 }
52 
53 std::string WDataSet::getFileName() const
54 {
55  return m_fileName;
56 }
57 
58 bool WDataSet::isTexture() const
59 {
60  return false;
61 }
62 
63 osg::ref_ptr< WDataTexture3D > WDataSet::getTexture() const
64 {
65  throw WDHException( std::string( "This dataset does not provide a texture." ) );
66 }
67 
68 const std::string WDataSet::getName() const
69 {
70  return "WDataSet";
71 }
72 
73 const std::string WDataSet::getDescription() const
74 {
75  return "Encapsulates the whole common feature set of all datasets.";
76 }
77 
78 boost::shared_ptr< WPrototyped > WDataSet::getPrototype()
79 {
80  if( !m_prototype )
81  {
82  m_prototype = boost::shared_ptr< WPrototyped >( new WDataSet() );
83  }
84 
85  return m_prototype;
86 }
87 
88 boost::shared_ptr< WDataSetVector > WDataSet::isVectorDataSet()
89 {
90  return boost::shared_ptr< WDataSetVector >();
91 }
92 
93 boost::shared_ptr< WProperties > WDataSet::getProperties() const
94 {
95  return m_properties;
96 }
97 
98 boost::shared_ptr< WProperties > WDataSet::getInformationProperties() const
99 {
100  return m_infoProperties;
101 }
102