summaryrefslogtreecommitdiff
path: root/indra/llplugin
diff options
context:
space:
mode:
authorskolb <none@none>2009-12-11 09:07:39 -0800
committerskolb <none@none>2009-12-11 09:07:39 -0800
commitf0da8a742015bdc63d044cba6dc249b20b8f5b45 (patch)
treeb4240e8789f390bb4811d91490bcd7810bf657c3 /indra/llplugin
parent6542ffe2f05c47d74dfbe659041d956d609f91f3 (diff)
parent0a8d9fa5b5d044bed7d4c38ec51d87bc90f3b3a6 (diff)
Merge media back into viewer 2-0
Diffstat (limited to 'indra/llplugin')
-rw-r--r--indra/llplugin/llpluginsharedmemory.cpp12
-rw-r--r--indra/llplugin/llpluginsharedmemory.h53
2 files changed, 62 insertions, 3 deletions
diff --git a/indra/llplugin/llpluginsharedmemory.cpp b/indra/llplugin/llpluginsharedmemory.cpp
index 3c69a69d28..9c18b410c7 100644
--- a/indra/llplugin/llpluginsharedmemory.cpp
+++ b/indra/llplugin/llpluginsharedmemory.cpp
@@ -1,6 +1,6 @@
/**
* @file llpluginsharedmemory.cpp
- * @brief LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API.
+ * LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API.
*
* @cond
* $LicenseInfo:firstyear=2008&license=viewergpl$
@@ -96,6 +96,10 @@ std::string LLPluginSharedMemory::createName(void)
return newname.str();
}
+/**
+ * @brief LLPluginSharedMemoryImpl is the platform-dependent implementation of LLPluginSharedMemory. TODO:DOC is this necessary/sufficient? kinda obvious.
+ *
+ */
class LLPluginSharedMemoryPlatformImpl
{
public:
@@ -112,6 +116,9 @@ public:
};
+/**
+ * Constructor. Creates a shared memory segment.
+ */
LLPluginSharedMemory::LLPluginSharedMemory()
{
mSize = 0;
@@ -121,6 +128,9 @@ LLPluginSharedMemory::LLPluginSharedMemory()
mImpl = new LLPluginSharedMemoryPlatformImpl;
}
+/**
+ * Destructor. Uses destroy() and detach() to ensure shared memory segment is cleaned up.
+ */
LLPluginSharedMemory::~LLPluginSharedMemory()
{
if(mNeedsDestroy)
diff --git a/indra/llplugin/llpluginsharedmemory.h b/indra/llplugin/llpluginsharedmemory.h
index 4014620c52..00c54ef08c 100644
--- a/indra/llplugin/llpluginsharedmemory.h
+++ b/indra/llplugin/llpluginsharedmemory.h
@@ -1,6 +1,5 @@
/**
* @file llpluginsharedmemory.h
- * @brief LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API.
*
* @cond
* $LicenseInfo:firstyear=2008&license=viewergpl$
@@ -36,6 +35,10 @@
class LLPluginSharedMemoryPlatformImpl;
+/**
+ * @brief LLPluginSharedMemory manages a shared memory segment for use by the LLPlugin API.
+ *
+ */
class LLPluginSharedMemory
{
LOG_CLASS(LLPluginSharedMemory);
@@ -46,16 +49,62 @@ public:
// Parent will use create/destroy, child will use attach/detach.
// Message transactions will ensure child attaches after parent creates and detaches before parent destroys.
- // create() implicitly creates a name for the segment which is guaranteed to be unique on the host at the current time.
+ /**
+ * Creates a shared memory segment, with a name which is guaranteed to be unique on the host at the current time. Used by parent.
+ * Message transactions will (? TODO:DOC - should? must?) ensure child attaches after parent creates and detaches before parent destroys.
+ *
+ * @param[in] size Shared memory size in TODO:DOC units = bytes?.
+ *
+ * @return False for failure, true for success.
+ */
bool create(size_t size);
+ /**
+ * Destroys a shared memory segment. Used by parent.
+ * Message transactions will (? TODO:DOC - should? must?) ensure child attaches after parent creates and detaches before parent destroys.
+ *
+ * @return True. TODO:DOC - always returns true. Is this the intended behavior?
+ */
bool destroy(void);
+ /**
+ * Creates and attaches a name to a shared memory segment. TODO:DOC what's the difference between attach() and create()?
+ *
+ * @param[in] name Name to attach to memory segment
+ * @param[in] size Size of memory segment TODO:DOC in bytes?
+ *
+ * @return False on failure, true otherwise.
+ */
bool attach(const std::string &name, size_t size);
+ /**
+ * Detaches shared memory segment.
+ *
+ * @return False on failure, true otherwise.
+ */
bool detach(void);
+ /**
+ * Checks if shared memory is mapped to a non-null address.
+ *
+ * @return True if memory address is non-null, false otherwise.
+ */
bool isMapped(void) const { return (mMappedAddress != NULL); };
+ /**
+ * Get pointer to shared memory.
+ *
+ * @return Pointer to shared memory.
+ */
void *getMappedAddress(void) const { return mMappedAddress; };
+ /**
+ * Get size of shared memory.
+ *
+ * @return Size of shared memory in bytes. TODO:DOC are bytes the correct unit?
+ */
size_t getSize(void) const { return mSize; };
+ /**
+ * Get name of shared memory.
+ *
+ * @return Name of shared memory.
+ */
std::string getName() const { return mName; };
private: