Photon C++ Client API  5.0.7.3
Public Member Functions | List of all members
JVector< Etype > Class Template Reference
Inheritance diagram for JVector< Etype >:
Inheritance graph
[legend]
Collaboration diagram for JVector< Etype >:
Collaboration graph
[legend]

Public Member Functions

 JVector (unsigned int initialCapacity=0, unsigned int capacityIncrement=1)
 
 JVector (const Etype *carray, unsigned int elementCount, unsigned int initialCapacity=0, unsigned int capacityIncrement=1)
 
virtual ~JVector (void)
 
 JVector (const JVector< Etype > &toCopy)
 
template<template< typename > class FT>
 JVector (const SequenceContainer< FT, Etype > &toCopy)
 
virtual JVector< Etype > & operator= (const SequenceContainer< Common::JVector, Etype > &toCopy)
 
template<template< typename > class FT>
JVector< Etype > & operator= (const SequenceContainer< FT, Etype > &toCopy)
 
virtual JVector< Etype > & operator= (const JVector< Etype > &rhv)
 
- Public Member Functions inherited from SequenceContainer< JVector, Etype >
virtual ~SequenceContainer (void)=0
 
SequenceContainer< JVector, Etype > & operator= (const SequenceContainer< JVector, Etype > &toCopy)
 
SequenceContainer< JVector, Etype > & operator= (const SequenceContainer< FT, Etype > &toCopy)
 
bool operator== (const SequenceContainer< JVector, Etype > &toCompare) const
 
bool operator!= (const SequenceContainer< JVector, Etype > &toCompare) const
 
const Etype & operator[] (unsigned int index) const
 
const Etype & operator[] (int index) const
 
Etype & operator[] (unsigned int index)
 
Etype & operator[] (int index)
 
unsigned int getCapacity (void) const
 
bool contains (const Etype &elem) const
 
const Etype & getFirstElement (void) const
 
int getIndexOf (const Etype &elem) const
 
bool getIsEmpty (void) const
 
const Etype & getLastElement (void) const
 
int getLastIndexOf (const Etype &elem) const
 
unsigned int getSize (void) const
 
const Etype * getCArray (void) const
 
void copyInto (Etype *array) const
 
void addElement (const Etype &obj)
 
void addElements (const Etype *carray, unsigned int elementCount)
 
void addElements (const SequenceContainer< FT, Etype > &container)
 
void ensureCapacity (unsigned int minCapacity)
 
void removeAllElements (void)
 
bool removeElement (const Etype &obj)
 
void trimToSize (void)
 
const Etype & getElementAt (unsigned int index) const
 
void insertElementAt (const Etype &obj, unsigned int index)
 
void removeElementAt (unsigned int index)
 
void setElementAt (const Etype &obj, unsigned int index)
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const
 
virtual JStringtoString (JString &retStr, bool withTypes=false) const =0
 
JString toString (bool withTypes=false) const
 
- Public Member Functions inherited from Base
virtual ~Base (void)=0
 
- Public Member Functions inherited from LoggingBase< Base >
virtual ~LoggingBase (void)=0
 
- Public Member Functions inherited from ToString
virtual ~ToString (void)
 
virtual JString typeToString (void) const
 
JString toString (bool withTypes=false) const
 

Additional Inherited Members

- Static Public Member Functions inherited from LoggingBase< Base >
static void setListener (const BaseListener *pBaseListener)
 
static int getDebugOutputLevel (void)
 
static bool setDebugOutputLevel (int debugLevel)
 
static const LogFormatOptionsgetLogFormatOptions (void)
 
static void setLogFormatOptions (const LogFormatOptions &options)
 

Detailed Description

template<typename Etype>
class ExitGames::Common::JVector< Etype >

This is a C++ implementation of the Vector Container class from Sun Java.

This class is based on the Java Vector class and as such contains all the public member functions of its Java equivalent. Unlike Java, typecasts are not necessary since C++ allows template instantiation of types at compile time. In addition to the Java public member functions, some operators were also added in order to take advantage of the operator overloading feature available in C++.

Constructor & Destructor Documentation

◆ JVector() [1/4]

JVector ( unsigned int  initialCapacity = 0,
unsigned int  capacityIncrement = 1 
)

Constructor.

Creates an empty container instance of elements of the type of the template parameter.

Parameters
initialCapacitythe amount of elements, the container instance can take without need for resize. If you choose this too small, the container instance needs expensive resizes later (it's most likely, that the complete memory has to be copied to a new location on resize), if you choose it too big, you will waste much memory. The default is 0.
capacityIncrementEvery time, when one adds an element to the Vector and it has no capacity left anymore, it's capacity will grow with this amount of elements on automatic resize. If you pass a too small value here, expensive resizes will be needed more often, if you choose a too big one, possibly memory is wasted. The default is 1.

◆ JVector() [2/4]

JVector ( const Etype *  carray,
unsigned int  elementCount,
unsigned int  initialCapacity = 0,
unsigned int  capacityIncrement = 1 
)

Constructor.

Creates a container instance, initialized with the passed carray of elements of the type of the template parameter.

Parameters
carrayall elements of this array up to elementCount will get copied into the constructed instance
elementCountshall not be greater than the actual element count of carray or undefined behavior will occur
initialCapacitythe amount of elements, the container instance can take without need for resize. Defaults to the value that gets passed for elementCount. If you choose this too small, the container instance needs expensive resizes later (it's most likely, that the complete memory has to be copied to a new location on resize), if you choose it too big, you will waste much memory.
capacityIncrementEvery time, when one adds an element to the container and it has no capacity left anymore, it's capacity will grow with this amount of elements on automatic resize. If you pass a too small value here, expensive resizes will be needed more often, if you choose a too big one, possibly memory is wasted. The default is 1.

◆ ~JVector()

~JVector ( void  )
virtual

Destructor.

◆ JVector() [3/4]

JVector ( const JVector< Etype > &  toCopy)

Copy-Constructor.

Creates an object out of a deep copy of its parameter.

Parameters
toCopyThe object to copy.

◆ JVector() [4/4]

JVector ( const SequenceContainer< FT, Etype > &  toCopy)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Member Function Documentation

◆ operator=() [1/3]

JVector< Etype > & operator= ( const SequenceContainer< Common::JVector< Etype >, Etype > &  toCopy)
virtual

operator=.

Makes a deep copy of its right operand into its left operand.

This overwrites old data in the left operand.

◆ operator=() [2/3]

JVector< Etype > & operator= ( const SequenceContainer< FT, Etype > &  toCopy)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ operator=() [3/3]

JVector< Etype > & operator= ( const JVector< Etype > &  toCopy)
virtual

operator=.

Makes a deep copy of its right operand into its left operand.

This overwrites old data in the left operand.