summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJosh Blum2012-11-11 23:21:45 -0800
committerJosh Blum2012-11-11 23:21:45 -0800
commitbe29a706ae227628b2e4a952f6aae97c9c66d5da (patch)
treedb011bdb194d8f95c655f9c82e379dd065611c60 /include
parent5ea36ce4fbf2198c9cc3652d1135247b0e1171f9 (diff)
downloadsandhi-be29a706ae227628b2e4a952f6aae97c9c66d5da.tar.gz
sandhi-be29a706ae227628b2e4a952f6aae97c9c66d5da.tar.bz2
sandhi-be29a706ae227628b2e4a952f6aae97c9c66d5da.zip
moved work buffer definition into its own header
Diffstat (limited to 'include')
-rw-r--r--include/gras/CMakeLists.txt1
-rw-r--r--include/gras/block.hpp37
-rw-r--r--include/gras/tags.hpp11
-rw-r--r--include/gras/work_buffer.hpp66
4 files changed, 75 insertions, 40 deletions
diff --git a/include/gras/CMakeLists.txt b/include/gras/CMakeLists.txt
index 628acfb..1e416e1 100644
--- a/include/gras/CMakeLists.txt
+++ b/include/gras/CMakeLists.txt
@@ -15,6 +15,7 @@ install(FILES
tags.hpp
thread_pool.hpp
top_block.hpp
+ work_buffer.hpp
DESTINATION include/gras
COMPONENT ${GRAS_COMP_DEVEL}
diff --git a/include/gras/block.hpp b/include/gras/block.hpp
index a45ddd3..ec4941f 100644
--- a/include/gras/block.hpp
+++ b/include/gras/block.hpp
@@ -6,6 +6,7 @@
#include <gras/element.hpp>
#include <gras/sbuffer.hpp>
#include <gras/tags.hpp>
+#include <gras/work_buffer.hpp>
#include <vector>
#include <string>
@@ -92,42 +93,6 @@ struct GRAS_API OutputPortConfig
size_t maximum_items;
};
-template <typename PtrType> struct WorkBuffer
-{
- //! get a native pointer type to this buffer
- inline PtrType get(void) const
- {
- return _mem;
- }
-
- //! get a pointer of the desired type to this buffer
- template <typename T> inline T cast(void) const
- {
- return reinterpret_cast<T>(this->get());
- }
-
- //! get the number of items in this buffer
- inline size_t size(void) const
- {
- return _len;
- }
-
- //! Get the memory pointer reference
- inline PtrType &get(void)
- {
- return _mem;
- }
-
- //! Get the buffer length reference
- inline size_t &size(void)
- {
- return _len;
- }
-
- PtrType _mem;
- size_t _len;
-};
-
struct GRAS_API Block : Element
{
diff --git a/include/gras/tags.hpp b/include/gras/tags.hpp
index 8b703fe..41a3e88 100644
--- a/include/gras/tags.hpp
+++ b/include/gras/tags.hpp
@@ -12,11 +12,14 @@ namespace gras
struct GRAS_API Tag : boost::less_than_comparable<Tag>
{
- //! Make an empty tag with null members
- Tag(void);
-
//! Make a tag from parameters to initialize the members
- Tag(const item_index_t &offset, const PMCC &key, const PMCC &value, const PMCC &srcid = PMCC());
+ Tag
+ (
+ const item_index_t &offset = 0,
+ const PMCC &key = PMCC(),
+ const PMCC &value = PMCC(),
+ const PMCC &srcid = PMCC()
+ );
//! the absolute item count associated with this tag
item_index_t offset;
diff --git a/include/gras/work_buffer.hpp b/include/gras/work_buffer.hpp
new file mode 100644
index 0000000..6695982
--- /dev/null
+++ b/include/gras/work_buffer.hpp
@@ -0,0 +1,66 @@
+// Copyright (C) by Josh Blum. See LICENSE.txt for licensing information.
+
+#ifndef INCLUDED_GRAS_WORK_BUFFER_HPP
+#define INCLUDED_GRAS_WORK_BUFFER_HPP
+
+#include <gras/gras.hpp>
+#include <cstdlib>
+
+namespace gras
+{
+
+template <typename PtrType>
+struct WorkBuffer
+{
+ //! get a pointer of the desired type to this buffer
+ template <typename T> T cast(void) const;
+
+ //! get a native pointer type to this buffer
+ PtrType get(void) const;
+
+ //! Get the memory pointer reference
+ PtrType &get(void);
+
+ //! get the number of items in this buffer
+ size_t size(void) const;
+
+ //! Get the buffer length reference
+ size_t &size(void);
+
+ PtrType _mem;
+ size_t _len;
+};
+
+template <typename PtrType> template <typename T>
+inline T WorkBuffer<PtrType>::cast(void) const
+{
+ return reinterpret_cast<T>(_mem);
+}
+
+template <typename PtrType>
+inline PtrType WorkBuffer<PtrType>::get(void) const
+{
+ return _mem;
+}
+
+template <typename PtrType>
+inline PtrType &WorkBuffer<PtrType>::get(void)
+{
+ return _mem;
+}
+
+template <typename PtrType>
+inline size_t WorkBuffer<PtrType>::size(void) const
+{
+ return _len;
+}
+
+template <typename PtrType>
+inline size_t &WorkBuffer<PtrType>::size(void)
+{
+ return _len;
+}
+
+} //namespace gras
+
+#endif /*INCLUDED_GRAS_WORK_BUFFER_HPP*/