diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /vendor/voclient/include/xmlrpc-c/girmem.hpp | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'vendor/voclient/include/xmlrpc-c/girmem.hpp')
-rw-r--r-- | vendor/voclient/include/xmlrpc-c/girmem.hpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/voclient/include/xmlrpc-c/girmem.hpp b/vendor/voclient/include/xmlrpc-c/girmem.hpp new file mode 100644 index 00000000..2eed4084 --- /dev/null +++ b/vendor/voclient/include/xmlrpc-c/girmem.hpp @@ -0,0 +1,75 @@ +#ifndef GIRMEM_HPP_INCLUDED +#define GIRMEM_HPP_INCLUDED + + +/* The following pthread crap mirrors what is in pthreadx.h, which is + what girmem.cpp uses to declare the lock interface. We can't simply + include pthreadx.h here, because it's an internal Xmlrpc-c header file, + and this is an external one. + + This is a stopgap measure until we do something cleaner, such as expose + pthreadx.h as an external interface (class girlock, maybe?) or create + a lock class with virtual methods. + + The problem we're solving is that class autoObject contains + a pthread_mutex_t member, and on Windows, there's no such type. +*/ + +#ifndef WIN32 +# include <pthread.h> + typedef pthread_mutex_t girmem_lock; +#else +# include <windows.h> + typedef CRITICAL_SECTION girmem_lock; +#endif + +namespace girmem { + +class autoObjectPtr; + +class autoObject { + friend class autoObjectPtr; + +public: + void incref(); + void decref(bool * const unreferencedP); + +protected: + autoObject(); + virtual ~autoObject(); + +private: + girmem_lock refcountLock; + unsigned int refcount; +}; + +class autoObjectPtr { +public: + autoObjectPtr(); + autoObjectPtr(girmem::autoObject * objectP); + autoObjectPtr(girmem::autoObjectPtr const& autoObjectPtr); + + ~autoObjectPtr(); + + void + point(girmem::autoObject * const objectP); + + void + unpoint(); + + autoObjectPtr + operator=(girmem::autoObjectPtr const& objectPtr); + + girmem::autoObject * + operator->() const; + + girmem::autoObject * + get() const; + +protected: + girmem::autoObject * objectP; +}; + +} // namespace + +#endif |