Commit c7faadc0 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] removed old properties partially

parent 97566341
......@@ -24,4 +24,4 @@
#include "WPreferences.h"
WProperties WPreferences::m_preferences;
WPropertiesOld WPreferences::m_preferences;
......@@ -32,7 +32,7 @@
#include <boost/program_options.hpp>
#include "../common/WIOTools.h"
#include "WProperties.h"
#include "WPropertiesOld.h"
#include "WLogger.h"
/**
......@@ -50,7 +50,7 @@ public:
template< typename T> static bool getPreference( std::string prefName, T* retVal );
protected:
private:
static WProperties m_preferences; //!< Structure for caching the preferences.
static WPropertiesOld m_preferences; //!< Structure for caching the preferences.
};
template< typename T > bool WPreferences::getPreference( std::string prefName, T* retVal )
......
......@@ -30,20 +30,20 @@
#include "../common/WLogger.h"
#include "WProperties.h"
#include "WPropertiesOld.h"
WProperties::WProperties()
WPropertiesOld::WPropertiesOld()
{
}
WProperties::~WProperties()
WPropertiesOld::~WPropertiesOld()
{
}
boost::signals2::signal1< void, std::string >* WProperties::addBool( std::string name, bool value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addBool( std::string name, bool value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -51,10 +51,10 @@ boost::signals2::signal1< void, std::string >* WProperties::addBool( std::string
return prop->getSignalValueChanged();
}
boost::signals2::signal1< void, std::string >* WProperties::addChar( std::string name, char value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addChar( std::string name, char value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -63,10 +63,10 @@ boost::signals2::signal1< void, std::string >* WProperties::addChar( std::string
}
boost::signals2::signal1< void, std::string >* WProperties::addInt( std::string name, int value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addInt( std::string name, int value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -75,10 +75,10 @@ boost::signals2::signal1< void, std::string >* WProperties::addInt( std::string
}
boost::signals2::signal1< void, std::string >* WProperties::addFloat( std::string name, float value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addFloat( std::string name, float value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -87,10 +87,10 @@ boost::signals2::signal1< void, std::string >* WProperties::addFloat( std::strin
}
boost::signals2::signal1< void, std::string >* WProperties::addDouble( std::string name, double value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addDouble( std::string name, double value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -100,9 +100,9 @@ boost::signals2::signal1< void, std::string >* WProperties::addDouble( std::stri
boost::signals2::signal1< void, std::string >*
WProperties::addString( std::string name, std::string value, bool hidden, std::string shortDesc, std::string longDesc )
WPropertiesOld::addString( std::string name, std::string value, bool hidden, std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -110,10 +110,10 @@ WProperties::addString( std::string name, std::string value, bool hidden, std::s
return prop->getSignalValueChanged();
}
boost::signals2::signal1< void, std::string >* WProperties::addColor( std::string name, WColor value, bool hidden,
boost::signals2::signal1< void, std::string >* WPropertiesOld::addColor( std::string name, WColor value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
m_propertyList[name] = prop;
......@@ -121,20 +121,20 @@ boost::signals2::signal1< void, std::string >* WProperties::addColor( std::strin
return prop->getSignalValueChanged();
}
void WProperties::addProperty( WProperty* prop )
void WPropertiesOld::addProperty( WProperty* prop )
{
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WProperties", LL_WARNING );
WLogger::getLogger()->addLogMessage( "[DEPRECATED] WProperty is deprecated. Use WPropertyVariable instead.", "WPropertiesOld", LL_WARNING );
m_propertyList[prop->getName()] = prop;
m_propertyVector.push_back( prop );
}
bool WProperties::existsProp( std::string name )
bool WPropertiesOld::existsProp( std::string name )
{
return ( findProp( name ) != 0 );
}
WProperty* WProperties::findProp( std::string name )
WProperty* WPropertiesOld::findProp( std::string name )
{
if( m_propertyList.count( name ) != 0 )
{
......@@ -151,7 +151,7 @@ WProperty* WProperties::findProp( std::string name )
}
std::string WProperties::getValueString( const std::string prop )
std::string WPropertiesOld::getValueString( const std::string prop )
{
if( findProp( prop ) )
{
......@@ -160,12 +160,12 @@ std::string WProperties::getValueString( const std::string prop )
return "";
}
std::vector< WProperty* >& WProperties::getPropertyVector()
std::vector< WProperty* >& WPropertiesOld::getPropertyVector()
{
return m_propertyVector;
}
void WProperties::hideProperty( std::string name )
void WPropertiesOld::hideProperty( std::string name )
{
if ( findProp( name ) )
{
......@@ -173,7 +173,7 @@ void WProperties::hideProperty( std::string name )
}
}
void WProperties::unhideProperty( std::string name )
void WPropertiesOld::unhideProperty( std::string name )
{
if ( findProp( name ) )
{
......@@ -181,7 +181,7 @@ void WProperties::unhideProperty( std::string name )
}
}
void WProperties::reemitChangedValueSignals()
void WPropertiesOld::reemitChangedValueSignals()
{
std::vector< WProperty* >::iterator iter;
for( iter = m_propertyVector.begin(); iter != m_propertyVector.end(); ++iter )
......@@ -196,7 +196,7 @@ void WProperties::reemitChangedValueSignals()
}
}
bool WProperties::isDirty() const
bool WPropertiesOld::isDirty() const
{
std::vector< WProperty* >::const_iterator cit;
for( cit = m_propertyVector.begin(); cit != m_propertyVector.end(); ++cit )
......
......@@ -22,8 +22,8 @@
//
//---------------------------------------------------------------------------
#ifndef WPROPERTIES_H
#define WPROPERTIES_H
#ifndef WPROPERTIESOLD_H
#define WPROPERTIESOLD_H
#include <map>
#include <string>
......@@ -39,18 +39,18 @@
/**
* class to manage properties of an object and to provide convinience methods for easy access and manipulation
*/
class WProperties
class WPropertiesOld
{
public:
/**
* standard constructor
*/
WProperties();
WPropertiesOld();
/**
* destructor
*/
virtual ~WProperties();
virtual ~WPropertiesOld();
/**
* sets a flag hidden, which can be used by the datasetbrowser for instance
......@@ -342,7 +342,7 @@ private:
boost::shared_mutex m_updateLock;
};
template< typename T > boost::signals2::signal1< void, std::string >* WProperties::addProperty( std::string name, T value, bool hidden,
template< typename T > boost::signals2::signal1< void, std::string >* WPropertiesOld::addProperty( std::string name, T value, bool hidden,
std::string shortDesc, std::string longDesc )
{
WProperty* prop = new WProperty( name, value, hidden, shortDesc, longDesc );
......@@ -351,4 +351,4 @@ template< typename T > boost::signals2::signal1< void, std::string >* WPropertie
return prop->getSignalValueChanged();
}
#endif // WPROPERTIES_H
#endif // WPROPERTIESOLD_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WPROPERTIES_TEST_H
#define WPROPERTIES_TEST_H
#include <cxxtest/TestSuite.h>
#include "../WLogger.h"
#include "../WProperties.h"
//TODO(math): When logger is singelton remove this!
static WLogger logger;
/**
* unit tests the properties class
*/
class WPropertiesTest : public CxxTest::TestSuite
{
public:
/**
* tests creating an integer property
*/
void testAddProp( void )
{
WProperties props;
props.addInt( "test", 57, "test57", "longDesc57" );
TS_ASSERT_EQUALS( props.getValue< int >( "test" ), 57 );
}
/**
* tests creating an integer property and changing its value
*/
void testChangeProp( void )
{
WProperties props;
props.addInt( "test", 57, "test57", "longDesc57" );
props.setValue( "test", 61 );
TS_ASSERT_EQUALS( props.getValue< int >( "test" ), 61 );
}
};
#endif // WPROPERTIES_TEST_H
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WPROPERTY_TEST_H
#define WPROPERTY_TEST_H
#include <cxxtest/TestSuite.h>
#include "../WProperty.h"
/**
* unit tests the property class
*/
class WPropertyTest : public CxxTest::TestSuite
{
public:
/**
* Tests the property class by creating a boolean property
*/
void testBool( void )
{
WProperty prop( "testProp", true );
TS_ASSERT_EQUALS( prop.getValue<bool>(), true );
}
/**
* Test whether a value can be set to a property.
*/
void testBoolSetFalse( void )
{
WProperty prop( "testProp", true );
prop.setValue( false );
TS_ASSERT_EQUALS( prop.getValue<bool>(), false );
}
/**
* Test whether the boolean is properly stored as string internally.
*/
void testBoolGetString( void )
{
WProperty prop( "testProp", true );
TS_ASSERT_EQUALS( prop.getValueString(), "1" );
}
};
#endif // WPROPERTY_TEST_H
......@@ -64,7 +64,6 @@ WModule::WModule():
m_moduleState()
{
// initialize members
m_properties = boost::shared_ptr< WProperties >( new WProperties() );
m_properties2 = boost::shared_ptr< WProperties2 >( new WProperties2() );
m_active = m_properties2->addProperty( "active", "Determines whether the module should be activated.", true, true );
m_active->getCondition()->subscribeSignal( boost::bind( &WModule::activate, this ) );
......@@ -326,11 +325,6 @@ void WModule::notifyDataChange( boost::shared_ptr< WModuleConnector > /*input*/,
// By default this callback does nothing. Overwrite it in your module.
}
boost::shared_ptr< WProperties > WModule::getProperties() const
{
return m_properties;
}
boost::shared_ptr< WProperties2 > WModule::getProperties2() const
{
return m_properties2;
......
......@@ -44,7 +44,6 @@
#include "../dataHandler/WValueSet.h"
#include "../common/WLogger.h"
#include "../common/WProperties.h"
#include "../common/WProperties2.h"
#include "../common/WProgressCombiner.h"
#include "../common/WProgress.h"
......@@ -117,13 +116,6 @@ public:
*/
boost::shared_ptr< WModuleOutputConnector > getOutputConnector( std::string name );
/**
* Return a pointer to the properties object of the module.
*
* \return the properties
*/
boost::shared_ptr< WProperties > getProperties() const;
/**
* Return a pointer to the properties object of the module.
*
......@@ -401,11 +393,6 @@ protected:
//
// **************************************************************************************************************************
/**
* the property object for the module
*/
boost::shared_ptr< WProperties > m_properties;
/**
* The property object for the module.
*/
......
......@@ -756,7 +756,9 @@ void WMMarchingCubes::renderMesh( boost::shared_ptr< WTriangleMesh2 > mesh )
state->addUniform( m_samplerUniforms[i] );
}
state->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useTexture", m_properties->getValue< bool >( "Use Texture" ) ) ) );
// TODO(wiebel): used? Not used? Replace by new Property please
// state->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useTexture", m_properties->getValue< bool >( "Use Texture" ) ) ) );
state->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useLighting", m_shaderUseLighting ) ) );
if( m_shaderUseTransparency )
{
......
......@@ -565,7 +565,8 @@ void WMNavSlices::updateTextures()
++c;
}
rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useTexture", m_properties->getValue< bool >( "Use Texture" ) ) ) );
// TODO(schurade): used? Not used? Replace by new Property please
// rootState->addUniform( osg::ref_ptr<osg::Uniform>( new osg::Uniform( "useTexture", m_properties->getValue< bool >( "Use Texture" ) ) ) );
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment