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

#include <OTRecordList.hpp>

Collaboration diagram for opentxs::OTLookupCaller:

Public Member Functions

EXPORT OTLookupCaller ()
 
EXPORT ~OTLookupCaller ()
 
EXPORT OTNameLookupgetCallback ()
 
EXPORT void delCallback ()
 
EXPORT void setCallback (OTNameLookup *cb)
 
EXPORT bool isCallbackSet () const
 
EXPORT std::string GetNymName (const std::string &str_id, const std::string *p_server_id=nullptr) const
 
EXPORT std::string GetAcctName (const std::string &str_id, const std::string *p_nym_id=nullptr, const std::string *p_server_id=nullptr, const std::string *p_asset_id=nullptr) const
 
EXPORT std::string GetAddressName (const std::string &str_address) const
 

Protected Attributes

OTNameLookup_callback
 

Detailed Description

Definition at line 192 of file OTRecordList.hpp.

Constructor & Destructor Documentation

EXPORT opentxs::OTLookupCaller::OTLookupCaller ( )
inline

Definition at line 198 of file OTRecordList.hpp.

199  : _callback(nullptr)
200  {
201  }
OTNameLookup * _callback
opentxs::OTLookupCaller::~OTLookupCaller ( )

Definition at line 269 of file OTRecordList.cpp.

270 {
271  otOut << "OTLookupCaller::~OTLookupCaller: (This should only "
272  "happen as the application is closing.)\n";
273 
274  delCallback();
275 }
OTLOG_IMPORT OTLogStream otOut

Member Function Documentation

void opentxs::OTLookupCaller::delCallback ( )

Definition at line 277 of file OTRecordList.cpp.

278 {
279  // if (nullptr != _callback) // TODO this may be a memory leak.
280  // delete _callback; // But I know we're currently crashing from
281  // deleting same object twice.
282  // And since the object comes from Java, who am I to delete it? Let Java
283  // clean it up.
284  if (isCallbackSet())
285  otOut << "OTLookupCaller::delCallback: WARNING: setting existing "
286  "callback object pointer to nullptr. "
287  "(This message doesn't trigger if it was already nullptr.)\n";
288  _callback = nullptr;
289 }
OTLOG_IMPORT OTLogStream otOut
OTNameLookup * _callback
EXPORT bool isCallbackSet() const
std::string opentxs::OTLookupCaller::GetAcctName ( const std::string &  str_id,
const std::string *  p_nym_id = nullptr,
const std::string *  p_server_id = nullptr,
const std::string *  p_asset_id = nullptr 
) const

Definition at line 331 of file OTRecordList.cpp.

335 {
336  if (isCallbackSet()) {
337  otWarn << "OTLookupCaller::GetAcctName: FYI, Executing address "
338  "book callback...\n";
339  return _callback->GetAcctName(str_id, p_nym_id, p_server_id,
340  p_asset_id);
341  }
342  else {
343  otOut << "OTLookupCaller::GetAcctName: "
344  "WARNING: Failed attempt to trigger address book "
345  "callback, due to \"it hasn't been set yet.\"\n";
346  }
347  return "";
348 }
OTLOG_IMPORT OTLogStream otOut
virtual EXPORT std::string GetAcctName(const std::string &str_id, const std::string *p_nym_id=nullptr, const std::string *p_server_id=nullptr, const std::string *p_asset_id=nullptr) const
OTLOG_IMPORT OTLogStream otWarn
OTNameLookup * _callback
EXPORT bool isCallbackSet() const
std::string opentxs::OTLookupCaller::GetAddressName ( const std::string &  str_address) const

Definition at line 350 of file OTRecordList.cpp.

351 {
352  if (isCallbackSet()) {
353  otWarn << "OTLookupCaller::GetAddressName: FYI, Executing "
354  "address book callback...\n";
355  return _callback->GetAddressName(str_address);
356  }
357  else {
358  otOut << "OTLookupCaller::GetAddressName: "
359  "WARNING: Failed attempt to trigger address book "
360  "callback, due to \"it hasn't been set yet.\"\n";
361  }
362  return "";
363 }
OTLOG_IMPORT OTLogStream otOut
virtual EXPORT std::string GetAddressName(const std::string &str_address) const
OTLOG_IMPORT OTLogStream otWarn
OTNameLookup * _callback
EXPORT bool isCallbackSet() const
EXPORT OTNameLookup* opentxs::OTLookupCaller::getCallback ( )
inline

Definition at line 204 of file OTRecordList.hpp.

205  {
206  return _callback;
207  }
OTNameLookup * _callback
std::string opentxs::OTLookupCaller::GetNymName ( const std::string &  str_id,
const std::string *  p_server_id = nullptr 
) const

Definition at line 315 of file OTRecordList.cpp.

317 {
318  if (isCallbackSet()) {
319  otWarn << "OTLookupCaller::GetNymName: FYI, Executing address "
320  "book callback...\n";
321  return _callback->GetNymName(str_id, p_server_id);
322  }
323  else {
324  otOut << "OTLookupCaller::GetNymName: "
325  "WARNING: Failed attempt to trigger address book "
326  "callback, due to \"it hasn't been set yet.\"\n";
327  }
328  return "";
329 }
OTLOG_IMPORT OTLogStream otOut
virtual EXPORT std::string GetNymName(const std::string &str_id, const std::string *p_server_id=nullptr) const
OTLOG_IMPORT OTLogStream otWarn
OTNameLookup * _callback
EXPORT bool isCallbackSet() const
bool opentxs::OTLookupCaller::isCallbackSet ( ) const

Definition at line 310 of file OTRecordList.cpp.

311 {
312  return (nullptr == _callback) ? false : true;
313 }
OTNameLookup * _callback
void opentxs::OTLookupCaller::setCallback ( OTNameLookup cb)

Definition at line 291 of file OTRecordList.cpp.

292 {
293  otOut << "OTLookupCaller::setCallback: Attempting to set the "
294  "OTNameLookup pointer...\n";
295 
296  if (nullptr == cb) {
297  otOut << "OTLookupCaller::setCallback: ERROR: nullptr "
298  "OTNameLookup object passed in. (Returning.)\n";
299  return;
300  }
301 
302  delCallback(); // Sets _callback to nullptr, but LOGS first, if it was
303  // already
304  // set.
305  _callback = cb;
306  otOut << "OTLookupCaller::setCallback: FYI, the OTNameLookup "
307  "pointer was set.\n";
308 }
OTLOG_IMPORT OTLogStream otOut
OTNameLookup * _callback

Member Data Documentation

OTNameLookup* opentxs::OTLookupCaller::_callback
protected

Definition at line 195 of file OTRecordList.hpp.


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