Open-Transactions  0.93.0-ge03d287
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
opentxs::OTInstrument Class Reference

#include <OTInstrument.hpp>

Inheritance diagram for opentxs::OTInstrument:
Collaboration diagram for opentxs::OTInstrument:

Public Member Functions

EXPORT OTInstrument ()
 
EXPORT OTInstrument (const OTIdentifier &SERVER_ID, const OTIdentifier &ASSET_ID)
 
virtual EXPORT ~OTInstrument ()
 
virtual EXPORT void Release ()
 
virtual bool SaveContractWallet (std::ofstream &ofs) const
 
void Release_Instrument ()
 
EXPORT bool VerifyCurrentDate ()
 
EXPORT bool IsExpired ()
 
time64_t GetValidFrom () const
 
time64_t GetValidTo () const
 
const OTIdentifierGetAssetID () const
 
const OTIdentifierGetServerID () const
 
void InitInstrument ()
 
- Public Member Functions inherited from opentxs::OTScriptable
virtual EXPORT void SetDisplayLabel (const std::string *pstrLabel=nullptr)
 
int32_t GetPartyCount () const
 
int32_t GetBylawCount () const
 
virtual EXPORT bool AddParty (OTParty &theParty)
 
virtual EXPORT bool AddBylaw (OTBylaw &theBylaw)
 
virtual EXPORT bool ConfirmParty (OTParty &theParty)
 
EXPORT OTPartyGetParty (std::string str_party_name) const
 
EXPORT OTBylawGetBylaw (std::string str_bylaw_name) const
 
EXPORT OTClauseGetClause (std::string str_clause_name) const
 
EXPORT OTPartyGetPartyByIndex (int32_t nIndex) const
 
EXPORT OTBylawGetBylawByIndex (int32_t nIndex) const
 
EXPORT OTPartyFindPartyBasedOnNymAsAgent (OTPseudonym &theNym, OTAgent **ppAgent=nullptr) const
 
EXPORT OTPartyFindPartyBasedOnNymAsAuthAgent (OTPseudonym &theNym, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnAccount (OTAccount &theAccount, OTPartyAccount **ppPartyAccount=nullptr) const
 
OTPartyFindPartyBasedOnNymIDAsAgent (const OTIdentifier &theNymID, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnNymIDAsAuthAgent (const OTIdentifier &theNymID, OTAgent **ppAgent=nullptr) const
 
OTPartyFindPartyBasedOnAccountID (const OTIdentifier &theAcctID, OTPartyAccount **ppPartyAccount=nullptr) const
 
OTAgentGetAgent (std::string str_agent_name) const
 
OTPartyAccountGetPartyAccount (std::string str_acct_name) const
 
OTPartyAccountGetPartyAccountByID (const OTIdentifier &theAcctID) const
 
EXPORT int32_t GetCountTransNumsNeededForAgent (std::string str_agent_name) const
 
virtual EXPORT bool VerifyNymAsAgent (OTPseudonym &theNym, OTPseudonym &theSignerNym, mapOfNyms *pmap_ALREADY_LOADED=nullptr) const
 
virtual EXPORT bool VerifyNymAsAgentForAccount (OTPseudonym &theNym, OTAccount &theAccount) const
 
bool VerifyPartyAuthorization (OTParty &theParty, OTPseudonym &theSignerNym, const OTString &strServerID, mapOfNyms *pmap_ALREADY_LOADED=nullptr, mapOfNyms *pmap_NEWLY_LOADED=nullptr, bool bBurnTransNo=false)
 
bool VerifyPartyAcctAuthorization (OTPartyAccount &thePartyAcct, OTPseudonym &theSignerNym, const OTString &strServerID, bool bBurnTransNo=false)
 
EXPORT bool VerifyThisAgainstAllPartiesSignedCopies ()
 
EXPORT bool AllPartiesHaveSupposedlyConfirmed ()
 
void RetrieveNymPointers (mapOfNyms &map_Nyms_Already_Loaded)
 
void ClearTemporaryPointers ()
 
bool GetHooks (std::string str_HookName, mapOfClauses &theResults)
 
OTClauseGetCallback (std::string str_CallbackName)
 
OTVariableGetVariable (std::string str_VarName)
 
bool IsDirty () const
 
bool IsDirtyImportant () const
 
void SetAsClean ()
 
EXPORT bool SendNoticeToAllParties (bool bSuccessMsg, OTPseudonym &theServerNym, const OTIdentifier &theServerID, const int64_t &lNewTransactionNumber, const OTString &strReference, OTString *pstrNote=nullptr, OTString *pstrAttachment=nullptr, OTPseudonym *pActualNym=nullptr) const
 
EXPORT bool CanExecuteClause (std::string str_party_name, std::string str_clause_name)
 
bool ExecuteCallback (OTClause &theCallbackClause, mapOfVariables &theParameters, OTVariable &varReturnVal)
 
virtual EXPORT void RegisterOTNativeCallsWithScript (OTScript &theScript)
 
virtual EXPORT bool Compare (OTScriptable &rhs) const
 
 OTScriptable ()
 
virtual ~OTScriptable ()
 
void UpdateContentsToString (OTString &strAppend, bool bCalculatingID) const
 
virtual EXPORT void CalculateContractID (OTIdentifier &newID) const
 
void Release_Scriptable ()
 
virtual void UpdateContents ()
 
- Public Member Functions inherited from opentxs::OTContract
const char * GetHashType () const
 
void SetIdentifier (const OTIdentifier &theID)
 
EXPORT OTContract ()
 
EXPORT OTContract (const OTString &name, const OTString &foldername, const OTString &filename, const OTString &strID)
 
EXPORT OTContract (const OTString &strID)
 
EXPORT OTContract (const OTIdentifier &theID)
 
void Initialize ()
 
virtual EXPORT ~OTContract ()
 
EXPORT void Release_Contract ()
 
EXPORT void ReleaseSignatures ()
 
virtual EXPORT bool CreateContract (const OTString &strContract, const OTPseudonym &theSigner)
 
EXPORT bool InsertNym (const OTString &strKeyName, const OTString &strKeyValue)
 
EXPORT void GetName (OTString &strName) const
 
EXPORT void SetName (const OTString &strName)
 
virtual EXPORT bool VerifyContract ()
 
virtual EXPORT void GetIdentifier (OTIdentifier &theIdentifier) const
 
virtual EXPORT void GetIdentifier (OTString &theIdentifier) const
 
EXPORT void GetFilename (OTString &strFilename) const
 
EXPORT void GetFoldername (OTString &strFoldername) const
 
virtual EXPORT bool LoadContract ()
 
EXPORT bool LoadContract (const char *szFoldername, const char *szFilename)
 
EXPORT bool LoadContractFromString (const OTString &theStr)
 
bool LoadContractRawFile ()
 
EXPORT bool ParseRawFile ()
 
EXPORT bool SaveToContractFolder ()
 
EXPORT bool SaveContractRaw (OTString &strOutput) const
 
EXPORT bool RewriteContract (OTString &strOutput) const
 
EXPORT bool SaveContract ()
 
EXPORT bool SaveContract (const char *szFoldername, const char *szFilename)
 
virtual EXPORT void CreateContents ()
 
EXPORT void CreateInnerContents ()
 
virtual EXPORT bool SaveContents (std::ofstream &ofs) const
 
virtual EXPORT bool SaveContractWallet (OTString &strContents) const
 
virtual EXPORT bool DisplayStatistics (OTString &strContents) const
 
virtual EXPORT bool SaveContents (OTString &strContents) const
 
virtual EXPORT bool SignContract (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContractAuthent (const OTPseudonym &theNym, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const OTAsymmetricKey &theKey, OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr)
 
EXPORT bool SignContract (const char *szFoldername, const char *szFilename, OTSignature &theSignature, const OTPasswordData *pPWData=nullptr)
 
virtual EXPORT bool VerifyContractID () const
 
virtual EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
virtual EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifyWithKey (const OTAsymmetricKey &theKey, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySigAuthent (const OTPseudonym &theNym, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const OTAsymmetricKey &theKey, const OTSignature &theSignature, const OTString &strHashType, const OTPasswordData *pPWData=nullptr) const
 
EXPORT bool VerifySignature (const char *szFoldername, const char *szFilename, const OTSignature &theSignature, const OTPasswordData *pPWData=nullptr) const
 
EXPORT const OTAsymmetricKeyGetContractPublicKey () const
 
EXPORT const OTPseudonymGetContractPublicNym () const
 

Protected Member Functions

virtual int32_t ProcessXMLNode (irr::io::IrrXMLReader *&xml)
 
void SetValidFrom (time64_t TIME_FROM)
 
void SetValidTo (time64_t TIME_TO)
 
void SetAssetID (const OTIdentifier &ASSET_ID)
 
void SetServerID (const OTIdentifier &SERVER_ID)
 
- Protected Member Functions inherited from opentxs::OTContract
bool LoadContractXML ()
 

Protected Attributes

OTIdentifier m_AssetTypeID
 
OTIdentifier m_ServerID
 
time64_t m_VALID_FROM
 
time64_t m_VALID_TO
 
- Protected Attributes inherited from opentxs::OTScriptable
mapOfParties m_mapParties
 
mapOfBylaws m_mapBylaws
 
bool m_bCalculatingID
 
bool m_bSpecifyAssetID
 
bool m_bSpecifyParties
 
OTString m_strLabel
 
- Protected Attributes inherited from opentxs::OTContract
OTString m_strName
 
OTString m_strFoldername
 
OTString m_strFilename
 
OTIdentifier m_ID
 
OTStringXML m_xmlUnsigned
 
OTString m_strRawFile
 
OTString m_strSigHashType
 
OTString m_strContractType
 
mapOfNyms m_mapNyms
 
listOfSignatures m_listSignatures
 
OTString m_strVersion
 
OTString m_strEntityShortName
 
OTString m_strEntityLongName
 
OTString m_strEntityEmail
 
OTString::Map m_mapConditions
 

Additional Inherited Members

- Static Public Member Functions inherited from opentxs::OTScriptable
static EXPORT OTScriptableInstantiateScriptable (const OTString &strInput)
 
static bool ValidateName (std::string str_name)
 
static std::string GetTime ()
 
- Static Public Member Functions inherited from opentxs::OTContract
static EXPORT bool DearmorAndTrim (const OTString &strInput, OTString &strOutput, OTString &strFirstLine)
 
static bool AddBookendsAroundContent (OTString &strOutput, const OTString &strContents, const OTString &strContractType, const OTString &strHashType, const listOfSignatures &listSignatures)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput)
 
static EXPORT bool LoadEncodedTextField (irr::io::IrrXMLReader *&xml, OTString &strOutput)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTASCIIArmor &ascOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool LoadEncodedTextFieldByName (irr::io::IrrXMLReader *&xml, OTString &strOutput, const char *&szName, OTString::Map *pmapExtraVars=nullptr)
 
static bool SkipToElement (irr::io::IrrXMLReader *&xml)
 
static bool SkipToTextField (irr::io::IrrXMLReader *&xml)
 
static bool SkipAfterLoadingField (irr::io::IrrXMLReader *&xml)
 
static EXPORT bool SignFlatText (OTString &strFlatText, const OTString &strContractType, const OTPseudonym &theSigner, OTString &strOutput)
 

Detailed Description

Definition at line 141 of file OTInstrument.hpp.

Constructor & Destructor Documentation

opentxs::OTInstrument::OTInstrument ( )

Definition at line 179 of file OTInstrument.cpp.

180  : OTScriptable()
183 {
184  InitInstrument();
185 }
#define OT_TIME_ZERO
Definition: Common.hpp:180
opentxs::OTInstrument::OTInstrument ( const OTIdentifier SERVER_ID,
const OTIdentifier ASSET_ID 
)

Definition at line 187 of file OTInstrument.cpp.

189  : OTScriptable()
190  , m_AssetTypeID(ASSET_ID)
191  , m_ServerID(SERVER_ID)
194 {
195  InitInstrument();
196 }
OTIdentifier m_AssetTypeID
#define OT_TIME_ZERO
Definition: Common.hpp:180
opentxs::OTInstrument::~OTInstrument ( )
virtual

Definition at line 198 of file OTInstrument.cpp.

199 {
201 
204 }
#define OT_TIME_ZERO
Definition: Common.hpp:180

Member Function Documentation

const OTIdentifier& opentxs::OTInstrument::GetAssetID ( ) const
inline

Definition at line 166 of file OTInstrument.hpp.

167  {
168  return m_AssetTypeID;
169  }
OTIdentifier m_AssetTypeID
const OTIdentifier& opentxs::OTInstrument::GetServerID ( ) const
inline

Definition at line 170 of file OTInstrument.hpp.

171  {
172  return m_ServerID;
173  }
time64_t opentxs::OTInstrument::GetValidFrom ( ) const
inline

Definition at line 157 of file OTInstrument.hpp.

158  {
159  return m_VALID_FROM;
160  }
time64_t opentxs::OTInstrument::GetValidTo ( ) const
inline

Definition at line 161 of file OTInstrument.hpp.

162  {
163  return m_VALID_TO;
164  }
void opentxs::OTInstrument::InitInstrument ( )

Definition at line 174 of file OTInstrument.cpp.

175 {
176  m_strContractType.Set("INSTRUMENT");
177 }
EXPORT void Set(const char *data, uint32_t enforcedMaxLength=0)
Definition: OTString.cpp:1055
OTString m_strContractType
Definition: OTContract.hpp:178
bool opentxs::OTInstrument::IsExpired ( )

Definition at line 148 of file OTInstrument.cpp.

149 {
150  const time64_t CURRENT_TIME = OTTimeGetCurrentTime();
151 
152  // If the current time is AFTER the valid-TO date,
153  // AND the valid_to is a nonzero number (0 means "doesn't expire")
154  // THEN return true (it's expired.)
155  //
156  if ((CURRENT_TIME >= m_VALID_TO) && (m_VALID_TO > OT_TIME_ZERO))
157  return true;
158  else
159  return false;
160 }
int64_t time64_t
Definition: Common.hpp:209
time64_t OTTimeGetCurrentTime()
Definition: Common.hpp:211
#define OT_TIME_ZERO
Definition: Common.hpp:180
int32_t opentxs::OTInstrument::ProcessXMLNode ( irr::io::IrrXMLReader *&  xml)
protectedvirtual

Reimplemented from opentxs::OTScriptable.

Reimplemented in opentxs::OTPaymentPlan, opentxs::OTAgreement, opentxs::OTSmartContract, opentxs::OTOffer, opentxs::OTCronItem, opentxs::OTTrade, opentxs::Token, and opentxs::OTCheque.

Definition at line 227 of file OTInstrument.cpp.

228 {
229  // otErr << "OTInstrument::ProcessXMLNode...\n";
230  int32_t nReturnVal = 0;
231 
232  // Here we call the parent class first.
233  // If the node is found there, or there is some error,
234  // then we just return either way. But if it comes back
235  // as '0', then nothing happened, and we'll continue executing.
236  //
237  // -- Note you can choose not to call the parent if
238  // you don't want to use any of those xml tags.
239  //
240 
241  nReturnVal = OTScriptable::ProcessXMLNode(xml);
242 
243  // -1 is error, and 1 is "found it". Either way, return.
244  if (nReturnVal != 0) {
245  return nReturnVal; // 0 means "nothing happened, keep going."
246  }
247  // This is from OTCronItem. It's only here as sample code.
248  //
249  // if (!strcmp("closingTransactionNumber", xml->getNodeName()))
250  // {
251  // OTString strClosingNumber = xml->getAttributeValue("value");
252  //
253  // if (strClosingNumber.Exists())
254  // {
255  // const int64_t lClosingNumber = atol(strClosingNumber.Get());
256  //
257  // AddClosingTransactionNo(lClosingNumber);
258  // }
259  // else
260  // {
261  // otErr << "Error in OTCronItem::ProcessXMLNode:
262  // closingTransactionNumber field without value.\n";
263  // return (-1); // error condition
264  // }
265  //
266  // nReturnVal = 1;
267  // }
268 
269  return nReturnVal;
270 }
virtual int32_t ProcessXMLNode(irr::io::IrrXMLReader *&xml)
void opentxs::OTInstrument::Release ( )
virtual

Reimplemented from opentxs::OTScriptable.

Reimplemented in opentxs::OTPaymentPlan, opentxs::OTAgreement, opentxs::OTSmartContract, opentxs::OTOffer, opentxs::OTCronItem, opentxs::OTTrade, opentxs::Token, opentxs::OTCheque, and opentxs::OTTrackable.

Definition at line 211 of file OTInstrument.cpp.

212 {
213  Release_Instrument(); // My own cleanup is performed here.
214  // Next give the base class a chance to do the same...
215  // since I've overridden the base class, I call it now
217  // Initialize everything back to 0
218  // InitInstrument(); // unnecessary.
219 }
virtual void Release()
void opentxs::OTInstrument::Release_Instrument ( )

Definition at line 206 of file OTInstrument.cpp.

207 {
208  // Release any dynamically allocated instrument members here.
209 }
bool opentxs::OTInstrument::SaveContractWallet ( std::ofstream &  ofs) const
virtual

Reimplemented from opentxs::OTScriptable.

Reimplemented in opentxs::OTPaymentPlan, opentxs::OTAgreement, opentxs::OTSmartContract, opentxs::Token, opentxs::OTOffer, opentxs::OTTrade, and opentxs::OTCheque.

Definition at line 221 of file OTInstrument.cpp.

222 {
223  return true;
224 }
void opentxs::OTInstrument::SetAssetID ( const OTIdentifier ASSET_ID)
inlineprotected

Definition at line 187 of file OTInstrument.hpp.

188  {
189  m_AssetTypeID = ASSET_ID;
190  }
OTIdentifier m_AssetTypeID
void opentxs::OTInstrument::SetServerID ( const OTIdentifier SERVER_ID)
inlineprotected

Definition at line 191 of file OTInstrument.hpp.

192  {
193  m_ServerID = SERVER_ID;
194  }
void opentxs::OTInstrument::SetValidFrom ( time64_t  TIME_FROM)
inlineprotected

Definition at line 179 of file OTInstrument.hpp.

180  {
181  m_VALID_FROM = TIME_FROM;
182  }
void opentxs::OTInstrument::SetValidTo ( time64_t  TIME_TO)
inlineprotected

Definition at line 183 of file OTInstrument.hpp.

184  {
185  m_VALID_TO = TIME_TO;
186  }
bool opentxs::OTInstrument::VerifyCurrentDate ( )

Definition at line 163 of file OTInstrument.cpp.

164 {
165  const time64_t CURRENT_TIME = OTTimeGetCurrentTime();
166 
167  if ((CURRENT_TIME >= m_VALID_FROM) &&
168  ((CURRENT_TIME <= m_VALID_TO) || (OT_TIME_ZERO == m_VALID_TO)))
169  return true;
170  else
171  return false;
172 }
int64_t time64_t
Definition: Common.hpp:209
time64_t OTTimeGetCurrentTime()
Definition: Common.hpp:211
#define OT_TIME_ZERO
Definition: Common.hpp:180

Member Data Documentation

OTIdentifier opentxs::OTInstrument::m_AssetTypeID
protected

Definition at line 197 of file OTInstrument.hpp.

OTIdentifier opentxs::OTInstrument::m_ServerID
protected

Definition at line 198 of file OTInstrument.hpp.

time64_t opentxs::OTInstrument::m_VALID_FROM
protected

Definition at line 200 of file OTInstrument.hpp.

time64_t opentxs::OTInstrument::m_VALID_TO
protected

Definition at line 202 of file OTInstrument.hpp.


The documentation for this class was generated from the following files: