Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jlib
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
captainwong
jlib
Commits
eebca79d
Commit
eebca79d
authored
Mar 21, 2015
by
captainwong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix grammer false
parent
0baf541c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
173 additions
and
173 deletions
+173
-173
global.h
global.h
+97
-98
observer_macro.h
observer_macro.h
+76
-75
No files found.
global.h
View file @
eebca79d
...
@@ -19,7 +19,7 @@ public:
...
@@ -19,7 +19,7 @@ public:
};
};
#define LOG_FUNCTION(func_name) LogFunction _log_function_object(func_name);
#define LOG_FUNCTION(func_name) LogFunction _log_function_object(func_name);
#define
LOG_FUNCTION_AUTO LOG_FUNCTION(__FUNCTION__)
#define
AUTO_LOG_FUNCTION LOG_FUNCTION(__FUNCTION__)
#include "C:/Global/MyWSAError.h"
#include "C:/Global/MyWSAError.h"
#include "c:/Global/observer_macro.h"
#include "c:/Global/observer_macro.h"
...
@@ -31,7 +31,6 @@ private:\
...
@@ -31,7 +31,6 @@ private:\
classname
(
const
classname
&
)
{}
\
classname
(
const
classname
&
)
{}
\
classname
&
operator
=
(
const
classname
&
)
{}
classname
&
operator
=
(
const
classname
&
)
{}
// singleton
// singleton
#define DECLARE_SINGLETON(class_name) \
#define DECLARE_SINGLETON(class_name) \
private
:
\
private
:
\
...
@@ -64,11 +63,11 @@ public: \
...
@@ -64,11 +63,11 @@ public: \
val
=
param
;
\
val
=
param
;
\
}
}
#define DE
ALARE_GETTER_SETTER(type, val) \
#define DE
CLARE_GETTER_SETTER(type, val) \
DECLARE_GETTER
(
type
,
val
)
\
DECLARE_GETTER
(
type
,
val
)
\
DECLARE_SETTER
(
type
,
val
)
DECLARE_SETTER
(
type
,
val
)
#define DE
ALARE_GETTER_SETTER_INT(val) \
#define DE
CLARE_GETTER_SETTER_INT(val) \
DECLARE_GETTER
(
int
,
val
)
\
DECLARE_GETTER
(
int
,
val
)
\
DECLARE_SETTER
(
int
,
val
)
DECLARE_SETTER
(
int
,
val
)
...
...
observer_macro.h
View file @
eebca79d
...
@@ -24,7 +24,7 @@ public: \
...
@@ -24,7 +24,7 @@ public: \
#define IMPLEMENT_OBSERVER(class_name) \
#define IMPLEMENT_OBSERVER(class_name) \
void
class_name
::
RegisterObserver
(
void
*
udata
,
_callback
cb
)
\
void
class_name
::
RegisterObserver
(
void
*
udata
,
_callback
cb
)
\
{
\
{
\
LOG_FUNCTION_AUTO; \
AUTO_LOG_FUNCTION
;
\
_lock4ObserverList
.
Lock
();
\
_lock4ObserverList
.
Lock
();
\
_callbackInfo
*
observer
=
new
_callbackInfo
(
udata
,
cb
);
\
_callbackInfo
*
observer
=
new
_callbackInfo
(
udata
,
cb
);
\
_observerList
.
push_back
(
observer
);
\
_observerList
.
push_back
(
observer
);
\
...
@@ -32,7 +32,7 @@ void class_name::RegisterObserver(void* udata, _callback cb) \
...
@@ -32,7 +32,7 @@ void class_name::RegisterObserver(void* udata, _callback cb) \
}
\
}
\
void
class_name
::
UnRegisterObserver
(
void
*
udata
)
\
void
class_name
::
UnRegisterObserver
(
void
*
udata
)
\
{
\
{
\
LOG_FUNCTION_AUTO; \
AUTO_LOG_FUNCTION
;
\
_lock4ObserverList
.
Lock
();
\
_lock4ObserverList
.
Lock
();
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
while
(
iter
!=
_observerList
.
end
())
{
\
while
(
iter
!=
_observerList
.
end
())
{
\
...
@@ -48,7 +48,7 @@ void class_name::UnRegisterObserver(void* udata) \
...
@@ -48,7 +48,7 @@ void class_name::UnRegisterObserver(void* udata) \
}
\
}
\
void
class_name
::
NotifyObservers
(
_param_type
param
)
\
void
class_name
::
NotifyObservers
(
_param_type
param
)
\
{
\
{
\
LOG_FUNCTION_AUTO; \
AUTO_LOG_FUNCTION
;
\
_lock4ObserverList
.
Lock
();
\
_lock4ObserverList
.
Lock
();
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
while
(
iter
!=
_observerList
.
end
())
{
\
while
(
iter
!=
_observerList
.
end
())
{
\
...
@@ -62,6 +62,7 @@ void class_name::NotifyObservers(_param_type param) \
...
@@ -62,6 +62,7 @@ void class_name::NotifyObservers(_param_type param) \
// place this macro in your class's destruct function.
// place this macro in your class's destruct function.
#define DESTROY_OBSERVER \
#define DESTROY_OBSERVER \
{
\
{
\
AUTO_LOG_FUNCTION
;
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
std
::
list
<
_callbackInfo
*>::
iterator
iter
=
_observerList
.
begin
();
\
while
(
iter
!=
_observerList
.
end
())
{
\
while
(
iter
!=
_observerList
.
end
())
{
\
_callbackInfo
*
observer
=
*
iter
++
;
\
_callbackInfo
*
observer
=
*
iter
++
;
\
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment