~ubuntu-branches/ubuntu/vivid/openwalnut/vivid

« back to all changes in this revision

Viewing changes to .pc/boost153/src/core/common/WPropertyBase.cpp

  • Committer: Package Import Robot
  • Author(s): Sebastian Eichelbaum
  • Date: 2014-03-19 17:46:12 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140319174612-e4mgtr1avbq3f7ph
Tags: 1.4.0~rc1+hg3a3147463ee2-1
* Major functionality and stability improvements.
* Several bug fixes
* Changed ttf-liberation dependency to fonts-liberation (Closes: #722405)
* OpenWalnut now works properly with OpenSceneGraph 3.2 (Closes: #718381)
* See http://www.openwalnut.org/versions/2

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 <list>
26
 
#include <string>
27
 
 
28
 
#include <boost/filesystem.hpp>
29
 
 
30
 
#include "exceptions/WPropertyNameMalformed.h"
31
 
#include "WProperties.h"
32
 
#include "WPropertyBase.h"
33
 
#include "WPropertyGroupBase.h"
34
 
#include "WPropertyVariable.h"
35
 
 
36
 
#include "WTransferFunction.h"
37
 
 
38
 
WPropertyBase::WPropertyBase( std::string name, std::string description ):
39
 
    boost::enable_shared_from_this< WPropertyBase >(),
40
 
    m_name( name ),
41
 
    m_description( description ),
42
 
    m_hidden( false ),
43
 
    m_purpose( PV_PURPOSE_PARAMETER ),
44
 
    signal_PropertyChange(),
45
 
    m_updateCondition( new WConditionSet() )
46
 
{
47
 
    // check name validity
48
 
    if( ( m_name.find( std::string( "/" ) ) != std::string::npos ) || m_name.empty() )
49
 
    {
50
 
        throw WPropertyNameMalformed( std::string( "Property name \"" + name +
51
 
                                      "\" is malformed. Do not use slashes (\"/\") or empty strings in property names." ) );
52
 
    }
53
 
}
54
 
 
55
 
WPropertyBase::WPropertyBase( const WPropertyBase& from ):
56
 
    boost::enable_shared_from_this< WPropertyBase >(),
57
 
    m_name( from.m_name ),
58
 
    m_description( from.m_description ),
59
 
    m_hidden( from.m_hidden ),
60
 
    m_type( from.m_type ),
61
 
    m_purpose( from.m_purpose ),
62
 
    signal_PropertyChange(),                    // create a new and empty signal
63
 
    m_updateCondition( new WConditionSet() )    // create a new condition set. Do not copy it.
64
 
{
65
 
}
66
 
 
67
 
WPropertyBase::~WPropertyBase()
68
 
{
69
 
    // cleanup
70
 
}
71
 
 
72
 
std::string WPropertyBase::getName() const
73
 
{
74
 
    return m_name;
75
 
}
76
 
 
77
 
std::string WPropertyBase::getDescription() const
78
 
{
79
 
    return m_description;
80
 
}
81
 
 
82
 
PROPERTY_TYPE WPropertyBase::getType() const
83
 
{
84
 
    return m_type;
85
 
}
86
 
 
87
 
PROPERTY_PURPOSE WPropertyBase::getPurpose() const
88
 
{
89
 
    return m_purpose;
90
 
}
91
 
 
92
 
void WPropertyBase::setPurpose( PROPERTY_PURPOSE purpose )
93
 
{
94
 
    m_purpose = purpose;
95
 
}
96
 
 
97
 
void WPropertyBase::updateType()
98
 
{
99
 
    m_type = PV_UNKNOWN;
100
 
}
101
 
 
102
 
bool WPropertyBase::isHidden() const
103
 
{
104
 
    return m_hidden;
105
 
}
106
 
 
107
 
void WPropertyBase::setHidden( bool hidden )
108
 
{
109
 
    if( m_hidden != hidden )
110
 
    {
111
 
        m_hidden = hidden;
112
 
        m_updateCondition->notify();
113
 
    }
114
 
}
115
 
 
116
 
WPropInt WPropertyBase::toPropInt()
117
 
{
118
 
    return boost::shared_static_cast< WPVInt >( shared_from_this() );
119
 
}
120
 
 
121
 
WPropDouble WPropertyBase::toPropDouble()
122
 
{
123
 
    return boost::shared_static_cast< WPVDouble >( shared_from_this() );
124
 
}
125
 
 
126
 
WPropBool WPropertyBase::toPropBool()
127
 
{
128
 
    return boost::shared_static_cast< WPVBool >( shared_from_this() );
129
 
}
130
 
 
131
 
WPropString WPropertyBase::toPropString()
132
 
{
133
 
    return boost::shared_static_cast< WPVString >( shared_from_this() );
134
 
}
135
 
 
136
 
WPropFilename WPropertyBase::toPropFilename()
137
 
{
138
 
    return boost::shared_static_cast< WPVFilename >( shared_from_this() );
139
 
}
140
 
 
141
 
WPropSelection WPropertyBase::toPropSelection()
142
 
{
143
 
    return boost::shared_static_cast< WPVSelection >( shared_from_this() );
144
 
}
145
 
 
146
 
WPropColor WPropertyBase::toPropColor()
147
 
{
148
 
    return boost::shared_static_cast< WPVColor >( shared_from_this() );
149
 
}
150
 
 
151
 
WPropPosition WPropertyBase::toPropPosition()
152
 
{
153
 
    return boost::shared_static_cast< WPVPosition >( shared_from_this() );
154
 
}
155
 
 
156
 
WPropGroup WPropertyBase::toPropGroup()
157
 
{
158
 
    return boost::shared_static_cast< WPVGroup >( shared_from_this() );
159
 
}
160
 
 
161
 
WPropertyGroupBase::SPtr WPropertyBase::toPropGroupBase()
162
 
{
163
 
    return boost::shared_static_cast< WPropertyGroupBase >( shared_from_this() );
164
 
}
165
 
 
166
 
WPropMatrix4X4 WPropertyBase::toPropMatrix4X4()
167
 
{
168
 
    return boost::shared_static_cast< WPVMatrix4X4 >( shared_from_this() );
169
 
}
170
 
 
171
 
WPropTrigger WPropertyBase::toPropTrigger()
172
 
{
173
 
    return boost::shared_static_cast< WPVTrigger >( shared_from_this() );
174
 
}
175
 
 
176
 
WPropTransferFunction WPropertyBase::toPropTransferFunction()
177
 
{
178
 
    return boost::shared_static_cast< WPVTransferFunction >( shared_from_this() );
179
 
}
180
 
 
181
 
boost::shared_ptr< WCondition > WPropertyBase::getUpdateCondition() const
182
 
{
183
 
    return m_updateCondition;
184
 
}
185