Commits (8)
......@@ -32,14 +32,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision: 36 $ *
* $Date: 2012-01-10 18:00:06 +0100 (Di, 10 Jan 2012) $ *
* $LastChangedBy: kremer $ *
* *
\*===========================================================================*/
#include <istream>
#include "OpenVolumeMeshStatus.hh"
......@@ -47,7 +39,11 @@
namespace OpenVolumeMesh {
std::ostream& operator<<(std::ostream& _ostr, const OpenVolumeMeshStatus& _status) {
_ostr << _status.selected() << " " << _status.tagged() << " " << _status.deleted() << std::endl;
_ostr << _status.selected()
<< " " << _status.tagged()
<< " " << _status.deleted()
<< " " << _status.hidden()
<< std::endl;
return _ostr;
}
......@@ -59,7 +55,8 @@ std::istream& operator>>(std::istream& _istr, OpenVolumeMeshStatus& _status) {
_status.set_tagged(b);
_istr >> b;
_status.set_deleted(b);
_istr >> b;
_status.set_hidden(b);
return _istr;
}
} // Namespace OpenVolumeMesh
......@@ -32,14 +32,6 @@
* *
\*===========================================================================*/
/*===========================================================================*\
* *
* $Revision$ *
* $Date$ *
* $LastChangedBy$ *
* *
\*===========================================================================*/
#ifndef STATUS_HH_
#define STATUS_HH_
......@@ -49,14 +41,13 @@ namespace OpenVolumeMesh {
/** \class OpenVolumeMeshStatus
*
* \brief Stores statuses like selected, tagged, deleted, etc.
* \brief Stores statuses like selected, tagged, deleted, hidden.
*/
class OpenVolumeMeshStatus {
public:
// Default constructor
OpenVolumeMeshStatus() : selected_(false), tagged_(false), deleted_(false) {}
OpenVolumeMeshStatus() = default;
bool selected() const { return selected_; }
......@@ -64,19 +55,25 @@ public:
bool deleted() const { return deleted_; }
bool hidden() const { return hidden_;}
void set_selected(bool _selected) { selected_ = _selected; }
void set_tagged(bool _tagged) { tagged_ = _tagged; }
void set_deleted(bool _deleted) { deleted_ = _deleted; }
void set_hidden(bool _hidden) {hidden_ = _hidden;}
private:
bool selected_;
bool selected_ = false;
bool tagged_ = false;
bool tagged_;
bool deleted_ = false;
bool deleted_;
bool hidden_ = false;
};
std::ostream& operator<<(std::ostream& _ostr, const OpenVolumeMeshStatus& _status);
......
......@@ -61,8 +61,8 @@ public:
public:
explicit OpenVolumeMeshBaseProperty(
const std::string& _name = "<unknown>",
const std::string& _internal_type_name = "<unknown>")
const std::string& _name,
const std::string& _internal_type_name)
: name_(_name),
internal_type_name_(_internal_type_name),
persistent_(false),
......
......@@ -73,8 +73,8 @@ public:
public:
explicit OpenVolumeMeshPropertyT(
const std::string& _name = "<unknown>",
const std::string& _internal_type_name = "<unknown>",
const std::string& _name,
const std::string& _internal_type_name,
const T &_def = T())
: OpenVolumeMeshBaseProperty(_name, _internal_type_name),
def_(_def)
......
......@@ -84,6 +84,8 @@ template <> const std::string entityTypeName<Entity::Mesh>();
template<typename T, typename Entity>
class PropertyTT : public PropertyPtr<OpenVolumeMeshPropertyT<T>, Entity> {
public:
using value_type = T;
using entity_type = Entity;
template<typename MeshT>
PropertyTT(MeshT *mesh, const std::string& _name, const T &_def = T())
: PropertyTT(std::move(mesh->template request_property<T, Entity>(_name, _def)))
......
......@@ -43,6 +43,7 @@
#include "OpenVolumeMeshProperty.hh"
#include "PropertyHandles.hh"
#include "TypeName.hh"
#include "ForwardDeclarations.hh"
namespace OpenVolumeMesh {
......@@ -222,7 +223,9 @@ public:
private:
template <class FullPropT, class PropIterT>
bool property_exists(const PropIterT& _begin, const PropIterT& _end, const std::string& _name) const {
bool property_exists(const PropIterT& _begin, const PropIterT& _end, const std::string& _name) const
{
auto type_name = get_type_name<typename FullPropT::value_type>();
if(_name.empty()) {
#ifndef NDEBUG
......@@ -235,16 +238,10 @@ private:
PropIterT it = _begin;
for(; it != _end; ++it)
{
if((*it)->name() == _name )
{
#if defined OVM_FORCE_STATIC_CAST && OVM_FORCE_STATIC_CAST
return true;
#else
if(dynamic_cast<FullPropT*>(*it) != nullptr)
if((*it)->name() == _name
&& (*it)->internal_type_name() == type_name)
{
return true;
}
#endif
return true;
}
}
return false;
......
#pragma once
#include <string>
#include <typeinfo>
......@@ -6,7 +8,7 @@
/// We need this in order to provide property type safety when
/// only limited RTTI support is available.
template<typename T>
std::string get_type_name()
inline std::string get_type_name()
{
#ifdef _MSC_VER
// MSVC's type_name only returns a friendly name with .name(),
......
#pragma once
#include "DeprecationConfig.hh"
#include "../Config/DeprecationConfig.hh"
#if defined(__cplusplus) && (__cplusplus >= 201402L)
# define OVM_DEPRECATED(msg) [[deprecated(msg)]]
......