#include <notifyCategoryProxy.h>
Public Member Functions | |
NotifyCategory * | init () |
Initializes the proxy object by calling get_category() on the template class. | |
NotifyCategory * | get_unsafe_ptr () |
Returns a pointer which is assumed to have been already initialized. | |
NotifyCategory * | get_safe_ptr () |
Returns a pointer which is *not* assumed to have been already initialized; if necessary, it will be initialized before it returns. | |
bool | is_on (NotifySeverity severity) |
bool | is_spam () |
bool | is_debug () |
bool | is_info () |
bool | is_warning () |
bool | is_error () |
bool | is_fatal () |
ostream & | out (NotifySeverity severity, bool prefix=true) |
ostream & | spam (bool prefix=true) |
ostream & | debug (bool prefix=true) |
ostream & | info (bool prefix=true) |
ostream & | warning (bool prefix=true) |
ostream & | error (bool prefix=true) |
ostream & | fatal (bool prefix=true) |
NotifyCategory * | operator-> () |
This magic operator function defines the syntax proxy->info(), etc., for all of the methods that are defined for NotifyCategory. | |
NotifyCategory & | operator * () |
This operator handles the case of dereferencing the proxy object as if it were a pointer, e.g. | |
operator NotifyCategory * () | |
This operator handles the case of passing the proxy object to a function that accepts a NotifyCategory pointer. | |
Private Attributes | |
NotifyCategory * | _ptr |
This wrapper pretends to be a NotifyCategory object itself, except that it is capable of initializing its pointer if it is NULL.
The advantage to this over a normal pointer is that it can be used in functions that run at static init time, without worrying about ordering issues among static init routines. If the pointer hasn't been initialized yet, no sweat; it can initialize itself.
This must be a template class so it can do this magic; it templates on a class with a static method called get_category() that returns a new pointer to the NotifyCategory. This way the compiler can generate correct static-init-independent code to initialize the proxy.
In general, if the proxy object is treated as if it were itself a NotifyCategory object, then it doesn't check whether its category is initialized, and so may not be run at static init time. That is, you may call proxy.info(), but only when you are not running at static init time. This is an optimization so you can avoid this unnecessary check when you know (as in most cases) the code does not run at static init.
On the other hand, if the proxy object is treated as if it were a *pointer* to a NotifyCategory object, then it *does* check whether its category is initialized; you may safely use it in this way at static init time. Thus, you may call proxy->info() safely whenever you like.
Definition at line 103 of file notifyCategoryProxy.h.
|
Definition at line 226 of file notifyCategoryProxy.I. References NotifyCategory::fatal(), and NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(). |
|
Definition at line 265 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_safe_ptr(), and INLINE. |
|
Definition at line 278 of file notifyCategoryProxy.I. |
|
Returns a pointer which is *not* assumed to have been already initialized; if necessary, it will be initialized before it returns. This function may be used in functions that might execute at static init time. All of the category methods that are accessed via the arrow operator, e.g. proxy->info(), use this method. Definition at line 88 of file notifyCategoryProxy.I. Referenced by NotifyCategoryProxy< GetCategory >::error(), NotifyCategoryProxy< GetCategory >::info(), and NotifyCategoryProxy< GetCategory >::warning(). |
|
Returns a pointer which is assumed to have been already initialized. This function should only be used in functions that will certainly not execute at static init time. All of the category methods that are accessed via the dot operator, e.g. proxy.info(), use this method. Definition at line 61 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::init(), and INLINE. Referenced by NotifyCategoryProxy< GetCategory >::debug(), NotifyCategoryProxy< GetCategory >::is_debug(), NotifyCategoryProxy< GetCategory >::is_error(), NotifyCategoryProxy< GetCategory >::is_fatal(), NotifyCategoryProxy< GetCategory >::is_info(), NotifyCategoryProxy< GetCategory >::is_on(), NotifyCategoryProxy< GetCategory >::is_spam(), NotifyCategoryProxy< GetCategory >::out(), and NotifyCategoryProxy< GetCategory >::spam(). |
|
Definition at line 239 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_safe_ptr(), and INLINE. |
|
Initializes the proxy object by calling get_category() on the template class.
Definition at line 34 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::_ptr, INLINE, nassertr, and NULL. Referenced by NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(). |
|
Definition at line 131 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), INLINE, and NotifyCategory::is_error(). |
|
Definition at line 174 of file notifyCategoryProxy.I. References NotifyCategory::debug(), NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), and INLINE. |
|
Definition at line 187 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), NotifyCategory::info(), and INLINE. |
|
Definition at line 148 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), INLINE, and NotifyCategory::is_fatal(). |
|
Definition at line 101 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), and NotifyCategory::is_debug(). |
|
Definition at line 114 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), INLINE, and NotifyCategory::is_info(). |
|
Definition at line 161 of file notifyCategoryProxy.I. |
|
This operator handles the case of dereferencing the proxy object as if it were a pointer, e.g. (*proxy).info(). It works the same way as the -> operator, above. Definition at line 320 of file notifyCategoryProxy.I. |
|
This operator handles the case of passing the proxy object to a function that accepts a NotifyCategory pointer. It works the same way as the -> and * operators, above. Definition at line 340 of file notifyCategoryProxy.I. |
|
This magic operator function defines the syntax proxy->info(), etc., for all of the methods that are defined for NotifyCategory. It's designed to vector through get_safe_ptr(), so this syntax is safe for functions that may execute at static init time. Definition at line 300 of file notifyCategoryProxy.I. |
|
Definition at line 200 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), INLINE, and NotifyCategory::warning(). |
|
Definition at line 213 of file notifyCategoryProxy.I. References NotifyCategory::error(), NotifyCategoryProxy< GetCategory >::get_unsafe_ptr(), and INLINE. |
|
Definition at line 252 of file notifyCategoryProxy.I. References NotifyCategoryProxy< GetCategory >::get_safe_ptr(), and INLINE. |
|
Definition at line 149 of file notifyCategoryProxy.h. Referenced by NotifyCategoryProxy< GetCategory >::init(). |