#include <ta0kira/global-sentry.hpp> class Abstract {}; class Implementation : public Abstract {}; int main() { protect::literal_capsule <Implementation> literal; protect::derivative_capsule <Abstract, Implementation> derivative; } |
#include <ta0kira/global-sentry.hpp> int main() { protect::literal_capsule <int> integer; integer.condemn(); while (integer.viewing_status()) /*wait X seconds*/; } |
#include <ta0kira/global-sentry.hpp> class Abstract {}; class Implementation : public Abstract {}; int main() { protect::dynamic_capsule <Abstract> dynamic; dynamic.auto_capture( Implementation() ); } |
#include <ta0kira/global-sentry.hpp> class Abstract {}; class Implementation : public Abstract {}; int main() { protect::dynamic_capsule <Abstract> dynamic; protect::derivative_capsule <Abstract, Implementation> derivative; dynamic = &derivative; protect::dynamic_capsule <Abstract> dynamic2(&derivative); } |
#include <ta0kira/global-sentry.hpp> class Abstract { virtual void function() = 0; }; class Implementation : public protect::selfcontained_capsule <Abstract, Implementation> { private: void function() {} }; |
#include <ta0kira/global-sentry.hpp> struct Abstract { Abstract() {} Abstract(int) {} virtual void function() = 0; }; struct Implementation : public protect::selfcontained_capsule <Abstract, Implementation> { private: void function() {} }; struct Implementation2 : public protect::selfcontained_capsule <Abstract, Implementation2, Implementation>, virtual private Abstract { Implementation2(int value) : Abstract(value) {} }; |
#include <ta0kira/global-sentry.hpp> struct Abstract { virtual bool function() = 0; }; struct Implementation : public Abstract { bool function() { return true; } }; class ModifyModule : public protect::capsule_modifier <Abstract> { entry_result access_entry(write_object oObj) const { if (!oObj) return protect::entry_denied; Abstract *object = NULL; if (!(object = oObj)) return protect::exit_forced; if (object->function()) return protect::entry_success; else return protect::entry_fail; } }; int main() { protect::derivative_capsule <Abstract, Implementation> derivative; ModifyModule modifier; bool result = !derivative.access_contents(&modifier); } |
#include <ta0kira/global-sentry.hpp> struct Abstract { virtual bool function() const = 0; }; struct Implementation : public Abstract { bool function() const { return true; } }; class ViewModule : public protect::capsule_viewer <Abstract> { entry_result view_entry(read_object oObj) const { if (!oObj) return protect::entry_denied; const Abstract *object = NULL; if (!(object = oObj)) return protect::exit_forced; if (object->function()) return protect::entry_success; else return protect::entry_fail; } }; int main() { protect::derivative_capsule <Abstract, Implementation> derivative; ViewModule viewer; bool result = !derivative.view_contents(&viewer); } |
#include <ta0kira/global-sentry.hpp> int main() { protect::literal_capsule <int> integer; protect::capsule <int> *integerCopy = integer.clone(); delete integerCopy; } |
#include <ta0kira/global-sentry.hpp> int main() { protect::literal_capsule <int> integer; unsigned char rawMemory[1024]; protect::capsule <int> *integerCopy = (protect::capsule <int>*) rawMemory; if (integer.clone_size() <= 1024) { integer.clone_to(integerCopy); integerCopy->protect::capsule <int> ::~capsule <int> (); } } |
Include the header <ta0kira/global-sentry-unix.hpp> instead of <ta0kira/global-sentry.hpp> throughout the entire program to use Unix functionality. You must compile and link to <ta0kira/global-sentry-unix.cpp> in the final program or library (this may be included in main.cpp as an alternative.)