hrplib
hrpUtil
Referenced.h
Go to the documentation of this file.
1
5
#ifndef OPENHRP_UTIL_REFERENCED_H_INCLUDED
6
#define OPENHRP_UTIL_REFERENCED_H_INCLUDED
7
8
#include <boost/intrusive_ptr.hpp>
9
10
namespace
hrp
{
11
class
Referenced;
12
void
intrusive_ptr_add_ref
(Referenced*
obj
);
13
void
intrusive_ptr_release
(Referenced*
obj
);
14
15
class
Referenced
16
{
17
public
:
18
Referenced
() {
refCounter_
= 0; }
19
virtual
~Referenced
() { }
20
21
protected
:
22
int
refCounter
() {
return
refCounter_
; }
23
24
private
:
25
friend
void
intrusive_ptr_add_ref
(
Referenced
*
obj
);
26
friend
void
intrusive_ptr_release
(
Referenced
* obj);
27
28
int
refCounter_
;
29
};
30
31
inline
void
intrusive_ptr_add_ref
(
hrp::Referenced
*
obj
){
32
obj->
refCounter_
++;
33
}
34
35
inline
void
intrusive_ptr_release
(
hrp::Referenced
*
obj
){
36
obj->
refCounter_
--;
37
if
(obj->
refCounter_
== 0){
38
delete
obj
;
39
}
40
}
41
};
42
43
#endif
hrp::intrusive_ptr_add_ref
void intrusive_ptr_add_ref(Referenced *obj)
Definition:
Referenced.h:31
hrp::intrusive_ptr_release
void intrusive_ptr_release(Referenced *obj)
Definition:
Referenced.h:35
hrp::Referenced::refCounter_
int refCounter_
Definition:
Referenced.h:28
hrp
Definition:
ColdetModel.h:28
hrp::Referenced::refCounter
int refCounter()
Definition:
Referenced.h:22
hrp::Referenced
Definition:
Referenced.h:15
hrp::Referenced::intrusive_ptr_release
friend void intrusive_ptr_release(Referenced *obj)
Definition:
Referenced.h:35
hrp::Referenced::intrusive_ptr_add_ref
friend void intrusive_ptr_add_ref(Referenced *obj)
Definition:
Referenced.h:31
viewSimTest.obj
obj
Definition:
viewSimTest.py:6
hrp::Referenced::Referenced
Referenced()
Definition:
Referenced.h:18
hrp::Referenced::~Referenced
virtual ~Referenced()
Definition:
Referenced.h:19
openhrp3
Author(s): AIST, General Robotix Inc., Nakamura Lab of Dept. of Mechano Informatics at University of Tokyo
autogenerated on Thu Sep 8 2022 02:24:05