From ed863c6379182292e79e40a71c51f22e6af80584 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 1 Sep 2014 09:38:56 -0400 Subject: [PATCH] Remove old swig implementation --- wrappers/old_swig/CMakeLists.txt | 128 ------ wrappers/old_swig/buildwrappers.sh | 56 --- wrappers/old_swig/opentxs.i | 627 ----------------------------- 3 files changed, 811 deletions(-) delete mode 100644 wrappers/old_swig/CMakeLists.txt delete mode 100755 wrappers/old_swig/buildwrappers.sh delete mode 100644 wrappers/old_swig/opentxs.i diff --git a/wrappers/old_swig/CMakeLists.txt b/wrappers/old_swig/CMakeLists.txt deleted file mode 100644 index c67c6d71e2..0000000000 --- a/wrappers/old_swig/CMakeLists.txt +++ /dev/null @@ -1,128 +0,0 @@ -# Copyright (c) Monetas AG, 2014 - -if(PYTHON OR PERL OR RUBY OR TCL OR JAVA OR PHP) - find_package(SWIG 3.0.0 REQUIRED) - include(${SWIG_USE_FILE}) - set(CMAKE_SWIG_FLAGS "") -endif() - - -include_directories(SYSTEM - ${CMAKE_CURRENT_SOURCE_DIR}/../deps/ - ${CMAKE_CURRENT_SOURCE_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../include/ - ${CMAKE_CURRENT_SOURCE_DIR}/../include/opentxs - ${CMAKE_CURRENT_SOURCE_DIR}/../include/opentxs/core - ${CMAKE_CURRENT_SOURCE_DIR}/../include/opentxs/ext - ${CMAKE_CURRENT_SOURCE_DIR}/../include/opentxs/api -) - -if(PYTHON) - find_package(PythonLibs) - include_directories(${PYTHON_INCLUDE_PATH}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-python python opentxs.i) - swig_link_libraries(opentxs-python ${PYTHON_LIBRARIES}) - target_link_libraries(_opentxs-python opentxs-api) - set_target_properties(_opentxs-python - PROPERTIES OUTPUT_NAME _opentxs) - string(REGEX REPLACE "\\.[0-9]+$" "" PYTHON_VERSION "${PYTHONLIBS_VERSION_STRING}") - install(TARGETS _opentxs-python - DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages - COMPONENT python) - install(FILES - ${CMAKE_CURRENT_BINARY_DIR}/opentxs.py - DESTINATION ${CMAKE_INSTALL_LIBDIR}/python${PYTHON_VERSION}/site-packages - COMPONENT python) -endif() - - -if(PERL) - find_package(PerlLibs) - include_directories(${PERL_INCLUDE_PATH}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-perl perl opentxs.i) - swig_link_libraries(opentxs-perl ${PERL_LIBRARIES}) - target_link_libraries(_opentxs-perl opentxs-api) - set_target_properties(_opentxs-perl - PROPERTIES OUTPUT_NAME _opentxs) - install(TARGETS _opentxs-perl - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT perl) -endif() - - -if(RUBY) - find_package(Ruby) - include_directories(${RUBY_INCLUDE_PATH}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-ruby ruby opentxs.i) - swig_link_libraries(opentxs-ruby ${RUBY_LIBRARIES}) - target_link_libraries(_opentxs-ruby opentxs-api) - set_target_properties(_opentxs-ruby - PROPERTIES OUTPUT_NAME _opentxs) - install(TARGETS _opentxs-ruby - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT ruby) -endif() - - -if(TCL) - find_package(TCL) - include_directories(${TCL_INCLUDE_PATH}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-tcl tcl opentxs.i) - swig_link_libraries(opentxs-tcl ${TCL_LIBRARIES}) - target_link_libraries(_opentxs-tcl opentxs-api) - set_target_properties(_opentxs-tcl - PROPERTIES OUTPUT_NAME _opentxs) - install(TARGETS _opentxs-tcl - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT tcl) -endif() - - -if(JAVA) - find_package(Java) - include_directories(${JAVA_INCLUDE_PATH}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-java java opentxs.i) - swig_link_libraries(opentxs-java ${JAVA_LIBRARIES}) - target_link_libraries(_opentxs-java opentxs-api) - set_target_properties(_opentxs-java - PROPERTIES OUTPUT_NAME _opentxs) - install(TARGETS _opentxs-java - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT java) -endif() - - -if(PHP) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}") - find_package(PHP5) - include_directories(${PHP5_INCLUDE_DIR} ${PHP5_MAIN_INCLUDE_DIR} ${PHP5_ZEND_INCLUDE_DIR} ${PHP5_TSRM_INCLUDE_DIR}) - set_source_files_properties(opentxs.i PROPERTIES CPLUSPLUS ON) - swig_add_module(opentxs-php php opentxs.i) - swig_link_libraries(opentxs-php ${PHP_LIBRARIES}) - target_link_libraries(_opentxs-php opentxs-api) - set_target_properties(_opentxs-php - PROPERTIES OUTPUT_NAME _opentxs) - install(TARGETS _opentxs-php - DESTINATION ${CMAKE_INSTALL_LIBDIR} - COMPONENT php) -endif() - - -if(GO) - ## -endif() - - -if(D) - ## -endif() - - -if(CSHARP) - ## -endif() diff --git a/wrappers/old_swig/buildwrappers.sh b/wrappers/old_swig/buildwrappers.sh deleted file mode 100755 index 217da76003..0000000000 --- a/wrappers/old_swig/buildwrappers.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - - -# Check for swig -if ! swig -version > /dev/null; then - echo Cannot find swig... - exit 1 -fi - -for x in csharp java perl5 php python ruby tcl d go -do - echo Generating for $x ... - - rm -rf glue/$x - mkdir glue/$x - - # Remove existing temporary wrapper files - for ext in cxx cpp h; do - if [ -f OTAPI_wrap.$ext ]; then 'rm -f OTAPI_wrap.$ext'; fi - done - - - if [ "$x" != "java" ] && [ "$x" != "csharp" ] && [ "$x" != "go" ]; then - echo swig -c++ -$x -outdir glue/$x OTAPI.i - swig -c++ -$x -outdir glue/$x OTAPI.i - fi - - if [ "$x" == "java" ]; then - echo swig -c++ -$x -package org.opentransactions.otapi -outdir glue/$x OTAPI.i - swig -c++ -$x -package org.opentransactions.otapi -outdir glue/$x OTAPI.i - fi - - if [ "$x" == "csharp" ]; then - echo swig -c++ -$x -namespace OpenTransactions.OTAPI -dllimport otapi-csharp -outdir glue/$x OTAPI.i - swig -c++ -"$x" -namespace OpenTransactions.OTAPI -dllimport otapi-csharp -outdir glue/$x OTAPI.i - fi - - if [ "$x" == "go" ]; then - echo swig -c++ -$x -intgosize 64 -soname libotapi-go.so -outdir glue/$x OTAPI.i - swig -c++ -$x -intgosize 64 -soname libotapi-go.so -outdir glue/$x OTAPI.i - fi - - # Remove old and rename header wrapper files - if [ -f OTAPI-$x.h ]; then rm OTAPI-$x.h; fi - if [ -f OTAPI_wrap.h ]; then mv OTAPI_wrap.h OTAPI-$x.hpp; fi - - # Remove old, rename and clean up source wrapper files - for ext in cxx cpp; do - if [ -f OTAPI-$x.$ext ]; then rm OTAPI-$x.$ext; fi - if [ -f OTAPI_wrap.$ext ]; then mv OTAPI_wrap.$ext OTAPI-$x.$ext; fi - if [ -f OTAPI-$x.$ext ]; then printf '%s\n' "g/OTAPI_wrap\.h/s//OTAPI-$x.hpp/g" w | ed -s "OTAPI-$x.$ext"; fi - done - -done - -echo Done! \ No newline at end of file diff --git a/wrappers/old_swig/opentxs.i b/wrappers/old_swig/opentxs.i deleted file mode 100644 index 627aee4e69..0000000000 --- a/wrappers/old_swig/opentxs.i +++ /dev/null @@ -1,627 +0,0 @@ -%module(directors="1") opentxs - -// remove these %ignores in updated version of swig... -// for inttypes.i - -%ignore strtoimax; -%ignore strtoumax; - - - - -#ifdef SWIGPERL -%{ - /* Workaround perl5 global namespace pollution. Note that undefining library - * functions like fopen will not solve the problem on all platforms as fopen - * might be a macro on Windows but not necessarily on other operating systems. */ - -#ifdef New -#undef New -#endif - -#ifdef seed - #undef seed -#endif -%} -#endif // SWIGPERL - -%include "inttypes.i" -%include "std_string.i"; -%include "std_vector.i"; -%include "std_map.i" -%include "typemaps.i" - - -// ALL -%{ -#ifndef IMPORT -#define IMPORT -#endif - -#include -#include -#include - -#include "../include/opentxs/core/OTPassword.hpp" -#include "../include/opentxs/api/OTAPI.hpp" -#include "../include/opentxs/api/OT_ME.hpp" -#include "../include/opentxs/core/OTStorage.hpp" -#include "../include/opentxs/core/OTAsymmetricKey.hpp" -#include "../include/opentxs/api/OTRecord.hpp" -#include "../include/opentxs/api/OTRecordList.hpp" - -%} - - -namespace std { - %template(VectorUnsignedChar) vector; - %template(MapStringString) map; -}; - - - - - -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// JAVA - - -// --------------------------------------------------------------- -#ifdef SWIGJAVA - -// this is generaly not a good thing to include (typesafe enums are good), however I need to investigate more if we can safely remove it. -// the main benifit from including this directive is that enums can be used in a switch statement, (however in later java I think that this is no-longer an issue). -%include "java/enumtypeunsafe.swg"; - -// -// ------------------------------------------------------------ -// Put this: inside the %typemap (javacode) for the class that you want to have equals(). -// -/* -%define OT_SUPPORT_EQUALS -#ifdef SWIGJAVA -public boolean equals(Object obj) { - boolean equal = false; - if (obj instanceof $javaclassname) - equal = ((($javaclassname)obj).swigCPtr == this.swigCPtr); // Look at this cast! I am using polymorphism, I can't cast like this.... - return equal; -} -public int32_t hashCode() { - return (int32_t)getPointer(); -} -#endif -%enddef -*/ - -// ------------------------------------------------------------------------------- -// Put a list of these ABOVE the class definitions below. -// ALL objects, containers AND elements, are OT Storable objects. -// -// These two blocks enable the object to dynamic cast back -// to its true type, after factory construction. -// -// TODO: Fix this since "this" doesn't work at static level. -// (Anyway, doesn't it already have a pointer to its container?) -%define OT_BEFORE_STORABLE_TYPE(STORABLE_TYPE_A) -//%typemap(javaout) STORABLE_TYPE_A * ot_dynamic_cast { -// int64_t cPtr = $jnicall; -// $javaclassname ret = null; -// if (cPtr != 0) { -// ret = new $javaclassname(cPtr, $owner); -// ret.addReference(this); -// } -// return ret; -//} -%enddef - -// Todo: add mapping to Java destruct process, so that when the proxy -// goes out of scope, it is smart enough to remove itself from the reference list. -// Why is it being added in the first place? Because it is pointing to a certain -// object -- therefore according to Java it should have a reference to that object. -// Otherwise it will end up pointing to bad memory, when that object gets cleaned -// up by the garbage collector (who THOUGHT no one was referencing it.) -// -// ------------------------------------------------------------------------------- - -// Put this: inside the %typemap(javacode) for the CONTAINER_TYPE (near the top of it.) -// -// Any container stores a list of references to its elements, -// where a reference is added each time you use the "Add" method, so -// that none of its elements are erased out from under it by the Java Garbage Collector. -// -%define OT_CONTAINER_TYPE_MEMBERS - private List elementList = new ArrayList(); -%enddef - -// ---------------------------- -// If a class is meant to be used as an element inside a container, then use this -// macro to create the necessary typemap for that class's GET method. -// -// Put it: With the rest of the TYPEMAP for the class in question. (Above the class -// definition itself, and above the container typemaps.) -// -// Swig uses it: Any container that defines a get method for that class based on -// the signature below: THE_ELEMENT_TYPE * Get##THE_ELEMENT_TYPE -// -%define OT_IS_ELEMENT_TYPE(THE_ELEMENT_TYPE_A) -// When the CONTAINER_TYPE's "Get" function is called, this will add a Java -// reference to prevent premature garbage collection and resulting use -// of dangling C++ pointer. Intended for methods that return pointers or -// references to a member variable. -%typemap(javaout,noblock=1) THE_ELEMENT_TYPE_A * Get##THE_ELEMENT_TYPE_A { - int64_t cPtr = $jnicall; - $javaclassname ret = null; - if (cPtr != 0) { - ret = new $javaclassname(cPtr, $owner); - ret.addReference(this); - } - return ret; -} -// ---- -// Swig uses this in every CONTAINER_TYPE's "Add" function, which all -// have a parameter profile matching this typemap. -// -%typemap(javain,noblock=1) THE_ELEMENT_TYPE_A & disownObject { getCPtrAddRef##THE_ELEMENT_TYPE_A($javainput) } - -// This is used by CONTAINER_TYPE's "Remove" function. Do not change the -// parameter name nIndex##name or this typemap will stop working... -%typemap(javain,noblock=1) size_t nIndex##THE_ELEMENT_TYPE_A { removeRef##THE_ELEMENT_TYPE_A($javainput) } - -%enddef -// ---------------------------------------------------------------------------------- - - -// The STORABLE_TYPE (BitcoinAcct, say) keeps a reference to its CONTAINER_TYPE (WalletData). -// -// Put it: inside the %typemap(javacode) for the ELEMENT_TYPE, for EACH possible container type. -// -%define OT_CAN_BE_CONTAINED_BY(CONTAINER_TYPE_A) - // Ensure that the GC doesn't collect any OT_CONTAINER instance set from Java - private CONTAINER_TYPE_A containerRef##CONTAINER_TYPE_A; - // ---------------- - protected void addReference(CONTAINER_TYPE_A theContainer) { // This is Java code - containerRef##CONTAINER_TYPE_A = theContainer; - } - // ---------------- -%enddef - -// ------------------------------------------------------------------------------- - -// You might wonder, why did I use THE_ELEMENT_TYPE_A and then THE_ELEMENT_TYPE_B, -// etc? Because I didn't want to risk one define somehow overlapping another and -// substituting the wrong name because they both happened to use the same token -// for substitution. Therefore I made sure they all had different token naming. -// (FYI.) - - -// The CONTAINER_TYPE (WalletData) uses this for *EACH* Get/Add/Remove item within. -// So this macro appears multiple times, if there are multiple deques. (Like a contact -// has nyms AND accounts inside of it.) -// -// Put it: inside the %typemap(javacode) for the CONTAINER_TYPE, for EACH ELEMENT_TYPE. -// -// Ensure that the GC doesn't collect any THE_ELEMENT_TYPE set from Java -// as the underlying C++ class stores a shallow copy - -// Altered the SWIG example so that we store a list of these references, instead -// of only the latest one. (None of them should go out of scope until this object does.) - -%define OT_ADD_ELEMENT(THE_ELEMENT_TYPE_B) // THIS BLOCK CONTAINS JAVA CODE. -private Long removeRef##THE_ELEMENT_TYPE_B(Long lIndex) { - // - // loop through the elements in the actual container, in order to find the one - // at lIndex. Once it is found, then loop through the reference list and remove - // the corresponding reference for that element. - // - THE_ELEMENT_TYPE_B refActualElement = Get##THE_ELEMENT_TYPE_B(lIndex); - - if (refActualElement == null) - return lIndex; // oh well. - - // Loop through the reference list and remove the corresponding reference - // for the specified element. - // - for(Integer intIndex = 0; intIndex < elementList.size(); intIndex++) - { - Object theObject = elementList.get(intIndex); - - if ((theObject == null) || !(theObject instanceof THE_ELEMENT_TYPE_B)) - continue; - - THE_ELEMENT_TYPE_B tempRef = (THE_ELEMENT_TYPE_B)(theObject); - - if ((THE_ELEMENT_TYPE_B.getCPtr(tempRef) == THE_ELEMENT_TYPE_B.getCPtr(refActualElement))) - { - elementList.remove(tempRef); - break; - } - } - - return lIndex; -} - -private Long getCPtrAddRef##THE_ELEMENT_TYPE_B(THE_ELEMENT_TYPE_B element) { - // Whenever adding a reference to the list, I remove it first (if already there.) - // That way we never store more than one reference per actual contained object. - // - for(Integer intIndex = 0; intIndex < elementList.size(); intIndex++) - { - Object theObject = elementList.get(intIndex); - - if ((theObject == null) || !(theObject instanceof THE_ELEMENT_TYPE_B)) - continue; - - THE_ELEMENT_TYPE_B tempRef = (THE_ELEMENT_TYPE_B)(theObject); - - if ((THE_ELEMENT_TYPE_B.getCPtr(tempRef) == THE_ELEMENT_TYPE_B.getCPtr(element))) - { - elementList.remove(tempRef); // It was already there, so let's remove it before adding (below.) - break; - } - } - // Now we add it... - // - THE_ELEMENT_TYPE_B tempLocalRef = element; - elementList.add(tempLocalRef); - return THE_ELEMENT_TYPE_B.getCPtr(element); -} // Hope I get away with overloading this for every type. Otherwise, -%enddef -// hope I can just change the function name to customize it to type. - -// ---------------------------------------- - - -OT_BEFORE_STORABLE_TYPE(OTDB::OTDBString) -OT_IS_ELEMENT_TYPE(OTDBString) - -%typemap(javacode,noblock=1) OTDB::OTDBString { - // ------------------------ -} - -// ******************************* - - -OT_BEFORE_STORABLE_TYPE(OTDB::Blob) -OT_IS_ELEMENT_TYPE(Blob) - -%typemap(javacode,noblock=1) OTDB::Blob { - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::StringMap) -OT_IS_ELEMENT_TYPE(StringMap) - -%typemap(javacode,noblock=1) OTDB::StringMap { - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::BitcoinAcct) -OT_IS_ELEMENT_TYPE(BitcoinAcct) - -%typemap(javacode,noblock=1) OTDB::BitcoinAcct { - OT_CAN_BE_CONTAINED_BY(WalletData) - // ------------------------ -} - -// ******************************* - - -OT_BEFORE_STORABLE_TYPE(OTDB::ServerInfo) -OT_IS_ELEMENT_TYPE(ServerInfo) - -%typemap(javacode,noblock=1) OTDB::ServerInfo { - OT_CAN_BE_CONTAINED_BY(ContactNym) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::BitcoinServer) -OT_IS_ELEMENT_TYPE(BitcoinServer) - -%typemap(javacode,noblock=1) OTDB::BitcoinServer { - OT_CAN_BE_CONTAINED_BY(WalletData) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::RippleServer) -OT_IS_ELEMENT_TYPE(RippleServer) - -%typemap(javacode,noblock=1) OTDB::RippleServer { - OT_CAN_BE_CONTAINED_BY(WalletData) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::LoomServer) -OT_IS_ELEMENT_TYPE(LoomServer) - -%typemap(javacode,noblock=1) OTDB::LoomServer { - OT_CAN_BE_CONTAINED_BY(WalletData) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::ContactNym) -OT_IS_ELEMENT_TYPE(ContactNym) - -%typemap(javacode,noblock=1) OTDB::ContactNym { - OT_CAN_BE_CONTAINED_BY(Contact) - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(ServerInfo) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::ContactAcct) -OT_IS_ELEMENT_TYPE(ContactAcct) - -%typemap(javacode,noblock=1) OTDB::ContactAcct { - OT_CAN_BE_CONTAINED_BY(Contact) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::WalletData) -OT_IS_ELEMENT_TYPE(WalletData) - -%typemap(javacode,noblock=1) OTDB::WalletData { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(BitcoinServer) - OT_ADD_ELEMENT(BitcoinAcct) - OT_ADD_ELEMENT(RippleServer) - OT_ADD_ELEMENT(LoomServer) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::Contact) -OT_IS_ELEMENT_TYPE(Contact) - -%typemap(javacode,noblock=1) OTDB::Contact { - OT_CAN_BE_CONTAINED_BY(AddressBook) - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(ContactNym) - OT_ADD_ELEMENT(ContactAcct) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::AddressBook) -OT_IS_ELEMENT_TYPE(AddressBook) - -%typemap(javacode,noblock=1) OTDB::AddressBook { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(Contact) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::MarketData) -OT_IS_ELEMENT_TYPE(MarketData) - -%typemap(javacode,noblock=1) OTDB::MarketData { - OT_CAN_BE_CONTAINED_BY(MarketList) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::MarketList) -OT_IS_ELEMENT_TYPE(MarketList) - -%typemap(javacode,noblock=1) OTDB::MarketList { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(MarketData) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::BidData) -OT_IS_ELEMENT_TYPE(BidData) - -%typemap(javacode,noblock=1) OTDB::BidData { - OT_CAN_BE_CONTAINED_BY(OfferListMarket) - // ------------------------ -} - -// ******************************* - - -OT_BEFORE_STORABLE_TYPE(OTDB::AskData) -OT_IS_ELEMENT_TYPE(AskData) - -%typemap(javacode,noblock=1) OTDB::AskData { - OT_CAN_BE_CONTAINED_BY(OfferListMarket) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::OfferListMarket) -OT_IS_ELEMENT_TYPE(OfferListMarket) - -%typemap(javacode,noblock=1) OTDB::OfferListMarket { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(BidData) - OT_ADD_ELEMENT(AskData) -} - - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::TradeDataMarket) -OT_IS_ELEMENT_TYPE(TradeDataMarket) - -%typemap(javacode,noblock=1) OTDB::TradeDataMarket { - OT_CAN_BE_CONTAINED_BY(TradeListMarket) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::TradeListMarket) -OT_IS_ELEMENT_TYPE(TradeListMarket) - -%typemap(javacode,noblock=1) OTDB::TradeListMarket { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(TradeDataMarket) -} - - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::OfferDataNym) -OT_IS_ELEMENT_TYPE(OfferDataNym) - -%typemap(javacode,noblock=1) OTDB::OfferDataNym { - OT_CAN_BE_CONTAINED_BY(OfferListNym) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::OfferListNym) -OT_IS_ELEMENT_TYPE(OfferListNym) - -%typemap(javacode,noblock=1) OTDB::OfferListNym { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(OfferDataNym) -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::TradeDataNym) -OT_IS_ELEMENT_TYPE(TradeDataNym) - -%typemap(javacode,noblock=1) OTDB::TradeDataNym { - OT_CAN_BE_CONTAINED_BY(TradeListNym) - // ------------------------ -} - -// ******************************* - -OT_BEFORE_STORABLE_TYPE(OTDB::TradeListNym) -OT_IS_ELEMENT_TYPE(TradeListNym) - -%typemap(javacode,noblock=1) OTDB::TradeListNym { - // ------------------------ - OT_CONTAINER_TYPE_MEMBERS - OT_ADD_ELEMENT(TradeDataNym) -} - -// ------------------------------------------------------------ -#endif // SWIGJAVA - - -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// ALL - - - // NOTE: these are supposed to be here, so that the Java garbage collector - // can clean up any memory it's finished with (from OT.) - // - // SWIG people: PLEASE update your documentation a bit. I've had to figure out - // this crap through trial-and-error. I thought SWIG was supposed to make things easier? - // If newobject is supported, then delobject should be supported to. Especially for JAVA, - // of all languages!! Also, if I have the custom code handlers for Java, Python, etc then - // why have SWIG at all? - - -%newobject CreateObject(StoredObjectType eType); -%newobject QueryObject(StoredObjectType theObjectType, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr=""); -%newobject DecodeObject(StoredObjectType theObjectType, std::string strInput); -%newobject Storage::QueryObject(StoredObjectType theObjectType, std::string strFolder, std::string oneStr="", std::string twoStr="", std::string threeStr=""); -%newobject Storage::DecodeObject(StoredObjectType theObjectType, std::string strInput); -%newobject Storage::CreateObject(StoredObjectType eType); -%newobject CreateStorageContext(StorageType eStoreType, PackType ePackType=OTDB_DEFAULT_PACKER); - - -%ignore OTRecord::operator<(const OTRecord & rhs); -%ignore OTPassword::operator=(const OTPassword & rhs); -%ignore OTPasswordData; -%ignore clone; -%ignore Storable::Create(StoredObjectType eType, PackType thePackType); -%ignore OTPasswordData; -%ignore PackedBuffer; -%ignore OTPacker; -%ignore PackerSubclass; -%ignore Storage::Create(StorageType eStorageType, PackType ePackType); -%ignore stat; -%ignore std::istream; -%ignore std::ostream; -%ignore msgpack::sbuffer; -%ignore std::map; -%ignore stlplus::simple_ptr_clone; - - -%ignore weak_ptr_OTRecord; - -%ignore vec_OTRecordList; -%ignore list_of_strings; -%ignore map_of_strings; - - -%rename(OTRecordLessThan) opentxs::OTRecord::operator<(const OTRecord& rhs); - -// The Callback definitions here, must appear BELOW the above SWIG directives that apply to them. -// The actual HEADER these definitions come from (OTStorage.hpp) must be included ABOVE THAT so that -// the SWIG directives will know what the hell we are talking about. Then those directives are actually -// applied here. -// Even below this section, you will see MORE SWIG directives, and then the definitions below those -// that THEY apply to. -// -%feature("director") OTCallback; -%feature("director") OTNameLookup; - -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// ----------------------------------------------------------- -// INCLUDE FILES - - -/* Parse the header file to generate wrappers */ - -#ifndef EXPORT -#define EXPORT -#endif - -%include "../include/opentxs/core/OTPassword.hpp" -%include "../include/opentxs/api/OTAPI.hpp" -%include "../include/opentxs/api/OT_ME.hpp" -%include "../include/opentxs/core/OTStorage.hpp" -%include "../include/opentxs/api/OTRecord.hpp" -%include "../include/opentxs/api/OTRecordList.hpp" - - -bool opentxs::OT_API_Set_PasswordCallback(OTCaller & theCaller); -bool opentxs::OT_API_Set_AddrBookCallback(OTLookupCaller & theCaller); - - -// add the follwing to every .cxx file. -%inline %{ - using namespace opentxs; - using namespace OTDB; - %} -