summaryrefslogtreecommitdiff
path: root/core/pla_getbyname.hpp
diff options
context:
space:
mode:
authorJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
committerJan Huwald <jh@sotun.de>2012-05-07 20:01:51 (GMT)
commit420d2ef464d4a741028e132e662d5626806a41f5 (patch)
tree1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/pla_getbyname.hpp
Initial commitHEADmaster
Diffstat (limited to 'core/pla_getbyname.hpp')
-rw-r--r--core/pla_getbyname.hpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/core/pla_getbyname.hpp b/core/pla_getbyname.hpp
new file mode 100644
index 0000000..30f2db0
--- /dev/null
+++ b/core/pla_getbyname.hpp
@@ -0,0 +1,37 @@
+#ifndef fwzTcntkbxdRjyBO90weDhBZ4Nc
+#define fwzTcntkbxdRjyBO90weDhBZ4Nc
+
+#include <string.h>
+
+#include "template_helpers.hpp"
+
+// PLA template
+template<template<typename Prop, typename QuantClass> class Payload,
+ typename BaseCase = Payload<BaseCase, Void>>
+struct PLA_GetByName {
+ // action types & consts
+ typedef BaseCase* result_t;
+ template<typename ContextProp, bool doWriteResults> struct local_state_t {
+ typedef ContextProp prop;
+ };
+
+ // action state
+ char *name;
+ result_t result;
+
+ PLA_GetByName(char *name) : name(name), result(NULL) {}
+
+ // action methods
+ template<typename _PropList, typename _ContextData, typename LocalState>
+ inline void pre(_PropList &pc, _ContextData &data, LocalState &state) {
+ typedef typename LocalState::prop Prop;
+ if (strcmp(Prop::name, name) == 0) {
+ result = new Payload<Prop, typename Prop::quant::class_t>();
+ }
+ }
+
+ template<typename _PropComp, typename _Data, typename _LocalState>
+ inline void post(_PropComp &, _Data &, _LocalState &) { }
+};
+
+#endif // fwzTcntkbxdRjyBO90weDhBZ4Nc
contact: Jan Huwald // Impressum