openscenegraph
Identifier
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2014 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSG_IDENTIFER_H
15#define OSG_IDENTIFER_H
16
17#include <osg/Referenced>
18#include <osg/Observer>
19
20#include <string>
21#include <cctype>
22
23#define OSG_HAS_IDENTIFIER
24
25namespace osg
26{
27
29inline bool iequals(const std::string& lhs, const std::string& rhs)
30{
31 if (lhs.size()!=rhs.size()) return false;
32
33 for(std::string::size_type i=0; i<lhs.size(); ++i)
34 {
35 if (std::tolower(lhs[i])!=std::tolower(rhs[i])) return false;
36 }
37
38 return true;
39}
40
41
45{
46public:
47 static Identifier* get(const std::string& name, int number=0, osg::Referenced* first=0, osg::Referenced* second=0);
48 static Identifier* get(int number, osg::Referenced* first=0, osg::Referenced* second=0);
49 static Identifier* get(osg::Referenced* first, osg::Referenced* second=0);
50
51 const std::string& name() const { return _name; }
52 const int& number() const { return _number; }
53
54protected:
55 Identifier(const std::string& name, int number, osg::Referenced* f, osg::Referenced* s);
56 virtual ~Identifier();
57
58 virtual void objectDeleted(void* ptr);
59
60 std::string _name;
64};
65
66}
67
68#endif
Definition Identifier:45
int _number
Definition Identifier:61
static Identifier * get(int number, osg::Referenced *first=0, osg::Referenced *second=0)
std::string _name
Definition Identifier:60
static Identifier * get(const std::string &name, int number=0, osg::Referenced *first=0, osg::Referenced *second=0)
Identifier(const std::string &name, int number, osg::Referenced *f, osg::Referenced *s)
virtual void objectDeleted(void *ptr)
osg::Referenced * _second
Definition Identifier:63
virtual ~Identifier()
const int & number() const
Definition Identifier:52
static Identifier * get(osg::Referenced *first, osg::Referenced *second=0)
const std::string & name() const
Definition Identifier:51
osg::Referenced * _first
Definition Identifier:62
Definition Observer:25
Definition Referenced:44
author: Julien Valentin 2017 (mp3butcher@hotmail.com)
Definition AlphaFunc:19
bool iequals(const std::string &lhs, const std::string &rhs)
Definition Identifier:29
#define OSG_EXPORT
Definition osg/Export:39