summaryrefslogtreecommitdiff
path: root/include/function.h
diff options
context:
space:
mode:
authorEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-08-31 15:41:04 -0700
committerEmiel Bruijntjes <emiel.bruijntjes@copernica.com>2013-08-31 15:41:04 -0700
commitd762ee103bee45bcd18df457c2c7a9f36991c75f (patch)
treebd8937a36a205a8755ac485c4ede65c10078b375 /include/function.h
parent708e9cf9da9571a38ac8d2529d016cd78ce8ec54 (diff)
Work in progress on a simpler api
Diffstat (limited to 'include/function.h')
-rw-r--r--include/function.h55
1 files changed, 12 insertions, 43 deletions
diff --git a/include/function.h b/include/function.h
index fec83e9..ef185ce 100644
--- a/include/function.h
+++ b/include/function.h
@@ -39,51 +39,32 @@ public:
Function(const char *name) : Function(name, {}) {}
/**
- * Copy constructor
+ * No copy constructor
* @param function The other function
*/
- Function(const Function &function)
+ Function(const Function &function) = delete;
+
+ /**
+ * Move constructor
+ * @param function The other function
+ */
+ Function(Function &&function)
{
- // copy other object
- _refcount = function._refcount;
_callable = function._callable;
-
- // increate number of references
- (*_refcount)++;
+ function._callable = nullptr;
}
/**
* Destructor
*/
- virtual ~Function()
- {
- // cleanup the object
- cleanup();
- }
+ virtual ~Function();
/**
- * Assignment operator
+ * No assignment operator
* @param function The other function
* @return Function
*/
- Function &operator=(const Function &function)
- {
- // skip self assignment
- if (&function == this) return *this;
-
- // cleanup the object
- cleanup();
-
- // copy other object
- _refcount = function._refcount;
- _callable = function._callable;
-
- // increate number of references
- (*_refcount)++;
-
- // done
- return *this;
- }
+ Function &operator=(const Function &function) {}
/**
* Method that gets called every time the function is executed
@@ -109,18 +90,6 @@ protected:
* @var smart_ptr
*/
Callable *_callable;
-
- /**
- * Counter with the number of references
- * @var integer
- */
- int *_refcount;
-
-
- /**
- * Remove one reference
- */
- void cleanup();
};
/**