Identifier
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#ifndef OSG_IDENTIFER_H
#define OSG_IDENTIFER_H
#include <osg/Referenced>
#include <osg/Observer>
#include <string>
#include <cctype>
#define OSG_HAS_IDENTIFIER
namespace osg
{
inline bool iequals(const std::string& lhs, const std::string& rhs)
{
if (lhs.size()!=rhs.size()) return false;
for(std::string::size_type i=0; i<lhs.size(); ++i)
{
if (std::tolower(lhs[i])!=std::tolower(rhs[i])) return false;
}
return true;
}
class OSG_EXPORT Identifier : public osg::Referenced, public osg::Observer
{
public:
static Identifier* get(const std::string& name, int number=0, osg::Referenced* first=0, osg::Referenced* second=0);
static Identifier* get(int number, osg::Referenced* first=0, osg::Referenced* second=0);
static Identifier* get(osg::Referenced* first, osg::Referenced* second=0);
const std::string& name() const { return _name; }
const int& number() const { return _number; }
protected:
Identifier(const std::string& name, int number, osg::Referenced* f, osg::Referenced* s);
virtual ~Identifier();
virtual void objectDeleted(void* ptr);
std::string _name;
int _number;
osg::Referenced* _first;
osg::Referenced* _second;
};
}
#endif
Observer
Referenced
osg::Identifier::_number
int _number
Definition Identifier:61
osg::Identifier::get
static Identifier * get(int number, osg::Referenced *first=0, osg::Referenced *second=0)
osg::Identifier::_name
std::string _name
Definition Identifier:60
osg::Identifier::get
static Identifier * get(const std::string &name, int number=0, osg::Referenced *first=0, osg::Referenced *second=0)
osg::Identifier::Identifier
Identifier(const std::string &name, int number, osg::Referenced *f, osg::Referenced *s)
osg::Identifier::objectDeleted
virtual void objectDeleted(void *ptr)
osg::Identifier::_second
osg::Referenced * _second
Definition Identifier:63
osg::Identifier::~Identifier
virtual ~Identifier()
osg::Identifier::number
const int & number() const
Definition Identifier:52
osg::Identifier::get
static Identifier * get(osg::Referenced *first, osg::Referenced *second=0)
osg::Identifier::name
const std::string & name() const
Definition Identifier:51
osg::Identifier::_first
osg::Referenced * _first
Definition Identifier:62
osg::Observer
Definition Observer:25
osg::Referenced
Definition Referenced:44
osg
Definition AlphaFunc:19
osg::iequals
bool iequals(const std::string &lhs, const std::string &rhs)
Definition Identifier:29
OSG_EXPORT
#define OSG_EXPORT
Definition osg/Export:39