EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyTuple Class Reference

Python tuple. More...

#include "PyRep.h"

Inheritance diagram for PyTuple:
Collaboration diagram for PyTuple:

Public Types

typedef std::vector< PyRep * > storage_type
 
typedef storage_type::iterator iterator
 
typedef
storage_type::const_iterator 
const_iterator
 
- Public Types inherited from PyRep
enum  PyType {
  PyTypeMin = 0, PyTypeInt = 1, PyTypeLong = 2, PyTypeFloat = 3,
  PyTypeBool = 4, PyTypeBuffer = 5, PyTypeString = 6, PyTypeWString = 7,
  PyTypeToken = 8, PyTypeTuple = 9, PyTypeList = 10, PyTypeDict = 11,
  PyTypeNone = 12, PyTypeSubStruct = 13, PyTypeSubStream = 14, PyTypeChecksumedStream = 15,
  PyTypeObject = 16, PyTypeObjectEx = 17, PyTypePackedRow = 18, PyTypeError = 19
}
 Python wire object types. More...
 

Public Member Functions

 PyTuple (size_t item_count)
 
 PyTuple (const PyTuple &oth)
 
 PyTuple (PyTuple &&oth)=delete
 
PyTupleoperator= (const PyTuple &oth)
 
PyTupleoperator= (PyTuple &&oth)=delete
 
PyRepClone () const
 Clones object. More...
 
bool visit (PyVisitor &v) const
 Visits object. More...
 
const_iterator begin () const
 
const_iterator end () const
 
size_t size () const
 
bool empty () const
 
void clear ()
 
PyRepGetItem (size_t index) const
 Returns Python object. More...
 
void SetItem (size_t index, PyRep *object)
 Stores Python object. More...
 
void SetItemInt (size_t index, int32 val)
 
void SetItemString (size_t index, const char *str)
 
int32 hash () const
 virtual function to generate a hash value of a object. More...
 
- Public Member Functions inherited from PyRep
PyType GetType () const
 
bool IsInt () const
 
bool IsLong () const
 
bool IsFloat () const
 
bool IsBool () const
 
bool IsBuffer () const
 
bool IsString () const
 
bool IsWString () const
 
bool IsToken () const
 
bool IsTuple () const
 
bool IsList () const
 
bool IsDict () const
 
bool IsNone () const
 
bool IsSubStruct () const
 
bool IsSubStream () const
 
bool IsChecksumedStream () const
 
bool IsObject () const
 
bool IsObjectEx () const
 
bool IsPackedRow () const
 
const char * TypeString () const
 
PyIntAsInt ()
 
const PyIntAsInt () const
 
PyLongAsLong ()
 
const PyLongAsLong () const
 
PyFloatAsFloat ()
 
const PyFloatAsFloat () const
 
PyBoolAsBool ()
 
const PyBoolAsBool () const
 
PyBufferAsBuffer ()
 
const PyBufferAsBuffer () const
 
PyStringAsString ()
 
const PyStringAsString () const
 
PyWStringAsWString ()
 
const PyWStringAsWString () const
 
PyTokenAsToken ()
 
const PyTokenAsToken () const
 
PyTupleAsTuple ()
 
const PyTupleAsTuple () const
 
PyListAsList ()
 
const PyListAsList () const
 
PyDictAsDict ()
 
const PyDictAsDict () const
 
PyNoneAsNone ()
 
const PyNoneAsNone () const
 
PySubStructAsSubStruct ()
 
const PySubStructAsSubStruct () const
 
PySubStreamAsSubStream ()
 
const PySubStreamAsSubStream () const
 
PyChecksumedStreamAsChecksumedStream ()
 
const PyChecksumedStreamAsChecksumedStream () const
 
PyObjectAsObject ()
 
const PyObjectAsObject () const
 
PyObjectExAsObjectEx ()
 
const PyObjectExAsObjectEx () const
 
PyPackedRowAsPackedRow ()
 
const PyPackedRowAsPackedRow () const
 
void Dump (FILE *into, const char *pfx) const
 Dumps object to file. More...
 
void Dump (LogType type, const char *pfx) const
 Dumps object to console. More...
 
- Public Member Functions inherited from RefObject
 RefObject (size_t initRefCount)
 Initializes reference count. More...
 
virtual ~RefObject ()
 Destructor; must be virtual. More...
 
size_t GetCount ()
 

Public Attributes

storage_type items
 

Protected Member Functions

virtual ~PyTuple ()
 
- Protected Member Functions inherited from PyRep
 PyRep (PyType t)
 
 PyRep (const PyRep &oth)
 
 PyRep (PyRep &&oth)=delete
 
PyRepoperator= (const PyRep &oth)=default
 
PyRepoperator= (PyRep &&oth)=default
 
virtual ~PyRep ()
 
- Protected Member Functions inherited from RefObject
void IncRef () const
 Increments reference count of object by one. More...
 
void DecRef () const
 Decrements reference count of object by one. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from PyRep
static std::string StringContent (PyRep *pRep)
 
static int64 IntegerValue (PyRep *pRep)
 
static uint32 IntegerValueU32 (PyRep *pRep)
 
- Protected Attributes inherited from PyRep
const PyType mType
 
- Protected Attributes inherited from RefObject
size_t mRefCount
 Reference count of instance. More...
 
bool mDeleted
 

Detailed Description

Python tuple.

Tuple. Unlike Python's, this one is mutable.

Definition at line 567 of file PyRep.h.

Member Typedef Documentation

typedef storage_type::const_iterator PyTuple::const_iterator

Definition at line 572 of file PyRep.h.

typedef storage_type::iterator PyTuple::iterator

Definition at line 571 of file PyRep.h.

typedef std::vector<PyRep*> PyTuple::storage_type

Definition at line 570 of file PyRep.h.

Constructor & Destructor Documentation

PyTuple::PyTuple ( size_t  item_count)

Definition at line 537 of file PyRep.cpp.

Referenced by Clone().

537 : PyRep( PyRep::PyTypeTuple ), items( item_count, nullptr ) {}
PyRep(PyType t)
Definition: PyRep.cpp:73
storage_type items
Definition: PyRep.h:628

Here is the caller graph for this function:

PyTuple::PyTuple ( const PyTuple oth)

Definition at line 538 of file PyRep.cpp.

539 {
540 }
PyRep(PyType t)
Definition: PyRep.cpp:73
storage_type items
Definition: PyRep.h:628
PyTuple::PyTuple ( PyTuple &&  oth)
delete
PyTuple::~PyTuple ( )
protectedvirtual

Definition at line 542 of file PyRep.cpp.

543 {
544  //for (auto cur : items)
545  // PySafeDecRef(cur);
546 }

Member Function Documentation

const_iterator PyTuple::begin ( ) const
inline

Definition at line 588 of file PyRep.h.

References items.

Referenced by operator=(), PyDumpVisitor::VisitTuple(), PyXMLGenerator::VisitTuple(), and PyVisitor::VisitTuple().

588 { return items.begin(); }
storage_type items
Definition: PyRep.h:628

Here is the caller graph for this function:

void PyTuple::clear ( )

Definition at line 558 of file PyRep.cpp.

References end(), items, and PySafeDecRef.

Referenced by operator=().

559 {
560  iterator cur = items.begin(), end = items.end();
561  for (; cur != end; ++cur)
562  PySafeDecRef( *cur );
563 
564  items.clear();
565 }
storage_type::iterator iterator
Definition: PyRep.h:571
#define PySafeDecRef(op)
Definition: PyRep.h:61
storage_type items
Definition: PyRep.h:628
const_iterator end() const
Definition: PyRep.h:589

Here is the call graph for this function:

Here is the caller graph for this function:

PyRep * PyTuple::Clone ( ) const
virtual

Clones object.

Returns
Indentical copy of object.

Implements PyRep.

Definition at line 548 of file PyRep.cpp.

References PyTuple().

Referenced by PyPacket::Clone(), PyCallStream::Clone(), and EVENotificationStream::Clone().

549 {
550  return new PyTuple( *this );
551 }
PyTuple(size_t item_count)
Definition: PyRep.cpp:537

Here is the call graph for this function:

Here is the caller graph for this function:

bool PyTuple::empty ( ) const
inline

Definition at line 592 of file PyRep.h.

References items.

Referenced by PyDumpVisitor::VisitTuple().

592 { return items.empty(); }
storage_type items
Definition: PyRep.h:628

Here is the caller graph for this function:

const_iterator PyTuple::end ( ) const
inline

Definition at line 589 of file PyRep.h.

References items.

Referenced by clear(), operator=(), PyDumpVisitor::VisitTuple(), PyXMLGenerator::VisitTuple(), and PyVisitor::VisitTuple().

589 { return items.end(); }
storage_type items
Definition: PyRep.h:628

Here is the caller graph for this function:

int32 PyTuple::hash ( ) const
virtual

virtual function to generate a hash value of a object.

virtual function to generate a hash value of a object to facilitate the various maps and checks.

Returns
returns a uint32 containing a hash function that represents the object.

Reimplemented from PyRep.

Definition at line 584 of file PyRep.cpp.

References items, and y().

585 {
586  long x=0, y=0;
587  int32 len = (int32)items.size();
588  long index = 0;
589  long mult = 1000003L;
590  x = 0x345678L;
591  while (--len >= 0) {
592  y = items[index++]->hash();
593  if (y == -1)
594  return -1;
595  x = (x ^ y) * mult;
596  /* the cast might truncate len; that doesn't change hash stability */
597  mult += (long)(82520L + len + len);
598  }
599  x += 97531L;
600  if (x == -1)
601  x = -2;
602  return (uint32)x;
603 }
itemID[count] Create count or of the specified() x() y(z)-Jump to the specified position in space.Stopped." ) COMMAND( translocate
signed __int32 int32
Definition: eve-compat.h:49
unsigned __int32 uint32
Definition: eve-compat.h:50
storage_type items
Definition: PyRep.h:628

Here is the call graph for this function:

PyTuple & PyTuple::operator= ( const PyTuple oth)

Definition at line 567 of file PyRep.cpp.

References begin(), clear(), end(), items, and size().

568 {
569  clear();
570  items.resize( oth.size() );
571  iterator cur = items.begin(), end = items.end();
572  const_iterator cur_oth = oth.begin(), oth_end = oth.end();
573  for (; cur != end && cur_oth != oth_end; ++cur, ++cur_oth)
574  {
575  if (*cur_oth == nullptr )
576  *cur = nullptr;
577  else
578  *cur = (*cur_oth)->Clone();
579  }
580 
581  return *this;
582 }
void clear()
Definition: PyRep.cpp:558
size_t size() const
Definition: PyRep.h:591
storage_type::const_iterator const_iterator
Definition: PyRep.h:572
storage_type::iterator iterator
Definition: PyRep.h:571
storage_type items
Definition: PyRep.h:628
const_iterator end() const
Definition: PyRep.h:589
const_iterator begin() const
Definition: PyRep.h:588

Here is the call graph for this function:

PyTuple& PyTuple::operator= ( PyTuple &&  oth)
delete
void PyTuple::SetItem ( size_t  index,
PyRep object 
)
inline

Stores Python object.

Parameters
[in]indexIndex at which the object should be stored.
[in]objectObject to be stored.

Definition at line 610 of file PyRep.h.

References items, PyIncRef, and PySafeDecRef.

Referenced by PasswordString::_CreateArgs(), GPSTransportClosed::_CreateArgs(), DBRowDescriptor::_CreateArgs(), CRowSet::_CreateArgs(), CIndexedRowSet::_CreateArgs(), CFilterRowSet::_CreateArgs(), UserError::_CreateArgs(), PyObjectEx_Type1::_CreateHeader(), PyObjectEx_Type2::_CreateHeader(), Client::_SendCallReturn(), Client::_SendPingResponse(), ClientSession::_Set(), AttributeMap::Add(), DBRowDescriptor::AddColumn(), SystemManager::AddMarker(), FleetService::AddMember(), UserError::AddParameterKeyword(), SystemEntity::ApplyDamage(), TradeService::CancelTrade(), AttributeMap::Change(), FleetService::CreateSquad(), FleetService::CreateWing(), DBResultToPackedRowListTuple(), DBResultToRowList(), ActiveModule::DeactivateCycle(), FleetService::DeleteSquad(), FleetService::DeleteWing(), MiningLaser::Depleted(), EVENotificationStream::Encode(), ClientSession::EncodeChanges(), ClientSession::EncodeInitialState(), TradeBound::ExchangeItems(), CorporationDB::Fetch(), FleetService::FleetBroadcast(), SovereigntyDataMgr::GetAllianceBeacons(), FleetService::GetAvailableFleets(), BookmarkDB::GetBookmarkDescription(), MapDB::GetDynamicData(), FleetService::GetFleetAdvert(), Agent::GetInfoServiceDetails(), Colony::GetLinks(), AgentBound::GetMissionObjectiveInfo(), AgentBound::GetMissionObjectives(), FleetService::GetMOTD(), MarketDB::GetOrders(), Colony::GetPins(), Scan::GetProbeDataForSig(), TowerSE::GetProcessInfo(), Character::GetRAMSkills(), CorporationDB::GetRecruiters(), Colony::GetRoutes(), CustomsSE::GetSettingsInfo(), ShipItem::GetShipInfo(), StaticDataMgr::GetStationCount(), StationDataMgr::GetStationItemBits(), PyService::Handle_MachoBindObject(), TradeService::InitiateTrade(), FleetService::LeaveFleet(), ActiveModule::LoadCharge(), ModuleManager::LoadCharge(), UnmarshalStream::LoadTuple(), UnmarshalStream::LoadTupleOne(), UnmarshalStream::LoadTupleTwo(), CustomsSE::MakeSlimItem(), StructureSE::MakeSlimItem(), WreckSE::MakeSlimItem(), WreckContainer::MakeSlimItemChange(), SBUSE::MarkContested(), new_tuple(), InventoryItem::Populate(), Scan::ProbeScanResult(), ProbeSE::RemoveProbe(), InventoryItem::Rename(), FleetService::RenameSquad(), FleetService::RenameWing(), FleetService::SendActiveStatus(), SystemBubble::SendAddBalls2(), Prospector::SendFailure(), Agent::SendMissionUpdate(), ProbeSE::SendNewProbe(), CynoModule::SendOnJumpBeaconChange(), Character::SendSkillQueue(), ProbeSE::SendSlimChange(), CustomsSE::SendSlimUpdate(), StructureSE::SendSlimUpdate(), ProbeSE::SendStateChange(), SystemManager::SendStaticBall(), ProbeSE::SendWarpEnd(), ProbeSE::SendWarpStart(), SetItemInt(), SetItemString(), FleetService::SetMOTD(), TCUSE::SetOnline(), ShipItem::ShipGetModuleList(), Scan::ShipScanResult(), ActiveModule::ShowEffect(), DroneSE::StateChange(), Scan::SystemScanStarted(), ShipItem::UnlinkGroup(), ShipItem::UnlinkWeapon(), DestinyManager::UpdateNewShip(), DestinyManager::UpdateOldShip(), FleetService::UpdateOptions(), and Agent::UpdateStandings().

611  {
612  PyRep** rep = &items.at( index );
613 
614  PySafeDecRef( *rep );
615  if (object == nullptr)
616  *rep = new PyNone();
617  else
618  *rep = object;
619  PyIncRef( *rep );
620  }
Base Python wire object.
Definition: PyRep.h:66
Python's "none".
Definition: PyRep.h:352
#define PyIncRef(op)
Definition: PyRep.h:56
#define PySafeDecRef(op)
Definition: PyRep.h:61
storage_type items
Definition: PyRep.h:628
void PyTuple::SetItemInt ( size_t  index,
int32  val 
)
inline

Definition at line 622 of file PyRep.h.

References SetItem().

622 { SetItem( index, new PyInt( val ) ); }
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610
Python integer.
Definition: PyRep.h:231

Here is the call graph for this function:

void PyTuple::SetItemString ( size_t  index,
const char *  str 
)
inline

Definition at line 623 of file PyRep.h.

References SetItem().

623 { SetItem( index, new PyString( str ) ); }
Python string.
Definition: PyRep.h:430
void SetItem(size_t index, PyRep *object)
Stores Python object.
Definition: PyRep.h:610

Here is the call graph for this function:

bool PyTuple::visit ( PyVisitor v) const
virtual

Visits object.

Parameters
[in]vVisitor to be used for visiting.
Return values
trueVisit successful.
falseError during visit.

Implements PyRep.

Definition at line 553 of file PyRep.cpp.

References PyVisitor::VisitTuple().

Referenced by PyPacket::Dump(), PyCallStream::Dump(), EVENotificationStream::Dump(), EVECollectDispatcher::Handle_CallReq(), EVECollectDispatcher::Handle_Notify(), EVECollectDispatcher::Handle_Other(), and tcp_callback().

554 {
555  return v.VisitTuple( this );
556 }
virtual bool VisitTuple(const PyTuple *rep)
the nested types Visitor
Definition: PyVisitor.cpp:36

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation


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