GenericContainerInterface Class Reference

#include <containerbase.h>

Public Types

enum class  INTERFACES {
  NONE ,
  VIRTUAL_TUPLE_CONTAINER ,
  ARRAY_CONTAINER ,
  XFORM_CONTAINER ,
  CONCAT_CONTAINER ,
  STATIC_ARRAY ,
  ARRAY ,
  SINGLE_VALUE_ARRAY ,
  BASE_ARRAY ,
  PAGED_ARRAY ,
  INDEXABLE ,
  MULTI_DOMAIN_CONTAINER ,
  SLICED_ARRAY ,
  MEMBER_ARRAY
}
 
using GenericContainerInterfaceMarker = void
 

Public Member Functions

MAXON_METHOD const ContainerDataTypeGetContainerType () const
 
enum maxon::GenericContainerInterface::INTERFACES MAXON_ENUM_FLAGS_CLASS (INTERFACES)
 
MAXON_METHOD INTERFACES GetInterfaces () const
 
MAXON_METHOD Result< GenericContainerInterface * > MakeWritable (Bool copyContent=true) const
 
 MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS (ResultRef< typename std::remove_const< typename S::PrivateReferencedType >::type > MakeWritableDontCopyContent() { return StrongCOWRefHandler::MakeWritableHelper< typename std::remove_const< typename S::PrivateReferencedType >::type >::MakeWritable(this->GetBaseRef(), false, false);})
 
MAXON_METHOD String ToString (const FormatStatement *formatStatement=nullptr) const
 
MAXON_METHOD HashInt GetHashCode () const
 
MAXON_METHOD UniqueHash GetUniqueHashCode () const
 
MAXON_METHOD Bool IsEqual (const GenericContainerInterface *other, EQUALITY equality) const
 
MAXON_METHOD Int FindMemberIndex (const InternedId &name) const
 
MAXON_FUNCTION Int FindMemberIndex (const Member &member) const
 
MAXON_METHOD Result< IntGetCount () const
 
MAXON_METHOD Int GetIteratorStateSize (const MemberMap *map) const
 
MAXON_METHOD Result< IntInitIterator (ViewIteratorMember *members, const MemberMap *map, Char *state, PersistentIdBuffer *idBuffer, Bool constAccess) const
 
MAXON_METHOD Result< IntValidateIterator (Int index, ViewIteratorMember *members, const MemberMap *map, Char *state, PersistentIdBuffer *idBuffer) const
 
MAXON_METHOD void FreeIterator (ViewIteratorMember *members, const MemberMap *map, Char *state, PersistentIdBuffer *idBuffer) const
 
MAXON_METHOD Result< IntMoveIterator (Int index, ViewIteratorMember *members, const MemberMap *map, Char *state, PersistentIdBuffer *idBuffer) const
 
MAXON_METHOD Result< void > AdvancePersistentId (Int index, const Char *state, PersistentIdBuffer &idBuffer) const
 
 MAXON_ADD_TO_CONST_REFERENCE_CLASS (using Iterator=maxon::details::ContainerIterator< T, false >;using ConstIterator=maxon::details::ContainerIterator< T, true >;)
 

Static Public Member Functions

static GenericContainerInterfaceAlloc (MAXON_SOURCE_LOCATION_DECLARATION)
 

Public Attributes

 MAXON_METHOD_RESERVE
 

Private Member Functions

 MAXON_INTERFACE_SIMPLE_VIRTUAL (GenericContainerInterface, MAXON_REFERENCE_COPY_ON_WRITE)
 
 MAXON_GENERIC ((ContainerVariance) typename T=NamedTuple<>)
 

Member Typedef Documentation

◆ GenericContainerInterfaceMarker

Member Enumeration Documentation

◆ INTERFACES

enum INTERFACES
strong

This enum informs about the interfaces which are implemented by a container and also about some implementation details (see GetInterfaces()).

Enumerator
NONE 

No interface.

VIRTUAL_TUPLE_CONTAINER 

The container is a virtual tuple container.

ARRAY_CONTAINER 

The container implements GenericArrayContainerInterface.

XFORM_CONTAINER 

The container is an xform container (see XformContainerActionsInterface).

CONCAT_CONTAINER 

The container is a concat container (see ContainerFactory::Concat).

STATIC_ARRAY 

The container implements StaticArrayInterface.

ARRAY 

The container implements ArrayInterface.

SINGLE_VALUE_ARRAY 

The container is a single-value array (see ArrayFactory::NewSingleValueArray). This is set in addition to ARRAY.

BASE_ARRAY 

The container uses an underlying BaseArray (see ArrayFactory::NewBaseArray). This is set in addition to ARRAY.

PAGED_ARRAY 

The container is a paged array (see ArrayFactory::NewPagedArray). This is set in addition to ARRAY.

INDEXABLE 

The container implements GenericIndexableContainerInterface.

MULTI_DOMAIN_CONTAINER 

The container implements MultiDomainContainerInterface.

SLICED_ARRAY 

The container is a subset of an array (see ArrayFactory::Slice). This is set in addition to ARRAY.

MEMBER_ARRAY 

The container is an array pointing to member data of a source array (see ArrayFactory::ExtractMember). This is set in addition to ARRAY.

Member Function Documentation

◆ MAXON_INTERFACE_SIMPLE_VIRTUAL()

MAXON_INTERFACE_SIMPLE_VIRTUAL ( GenericContainerInterface  ,
MAXON_REFERENCE_COPY_ON_WRITE   
)
private

◆ MAXON_GENERIC()

MAXON_GENERIC ( (ContainerVariance) typename  T = NamedTuple<>)
private

◆ Alloc()

◆ GetContainerType()

MAXON_METHOD const ContainerDataType& GetContainerType ( ) const

◆ MAXON_ENUM_FLAGS_CLASS()

enum maxon::GenericContainerInterface::INTERFACES MAXON_ENUM_FLAGS_CLASS ( INTERFACES  )

◆ GetInterfaces()

MAXON_METHOD INTERFACES GetInterfaces ( ) const

Returns INTERFACES flags corresponding to the interfaces implemented by this container. You can safely cast the container to these interfaces.

Returns
INTERFACES flags for this container.

◆ MakeWritable()

MAXON_METHOD Result<GenericContainerInterface*> MakeWritable ( Bool  copyContent = true) const

Returns a writable copy of this container. This may return a different implementation of the interface if the current implementation only supports read-only access (for example a container implementation where all elements have the same value). If there's just a single reference to the container, the container itself may be returned.

By default the value of copyContent is true. Then the content of the copy will be equal to the content of the original container. However if you don't need that because you're going to overwrite the complete content anyway, you can use false for copyContent. Then the content of the copy is unspecified, so the implementation is free to skip copying the content and the returned copy may even be empty. In particular any indexed read or write access to elements without a prior call to a method like Resize may fail.

Note
Don't confuse this method with the MakeWritable function of reference classes. The latter makes sure that the object held by a COW reference is writable by calling this MakeWritable function (with default true value for copyContent) and then replacing the object of the COW reference by the returned object. This MakeWritable method is a const method which doesn't change anything. For containers the COW reference class has an additional MakeWritableDontCopyContent function which uses false for copyContent, you can use that function to make the object of a COW reference writable when you are going to overwrite its complete content.
Parameters
[in]copyContentTrue (the default) if the content shall be copied, false otherwise (then just a new object with a writable implementation is created, its content is unspecified and may be empty).
Returns
Pointer to the writable container object. @MAXON_ANNOTATION{refclass=false}

◆ MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS()

MAXON_ADD_TO_COPY_ON_WRITE_REFERENCE_CLASS ( ResultRef< typename std::remove_const< typename S::PrivateReferencedType >::type > MakeWritableDontCopyContent() { return StrongCOWRefHandler::MakeWritableHelper< typename std::remove_const< typename S::PrivateReferencedType >::type >::MakeWritable(this->GetBaseRef(), false, false);}  )

◆ ToString()

MAXON_METHOD String ToString ( const FormatStatement formatStatement = nullptr) const

◆ GetHashCode()

MAXON_METHOD HashInt GetHashCode ( ) const

◆ GetUniqueHashCode()

MAXON_METHOD UniqueHash GetUniqueHashCode ( ) const

◆ IsEqual()

MAXON_METHOD Bool IsEqual ( const GenericContainerInterface other,
EQUALITY  equality 
) const

◆ FindMemberIndex() [1/2]

MAXON_METHOD Int FindMemberIndex ( const InternedId name) const

Finds the member index of the member with the given name in this. If no such member can be found, -1 is returned.

Parameters
[in]nameName of the member to find.
Returns
Index of the member, or -1 if it doesn't exist. @MAXON_ANNOTATION{default=-1}

◆ FindMemberIndex() [2/2]

MAXON_FUNCTION Int FindMemberIndex ( const Member member) const

◆ GetCount()

MAXON_METHOD Result<Int> GetCount ( ) const

@MAXON_ANNOTATION{default=0}

◆ GetIteratorStateSize()

MAXON_METHOD Int GetIteratorStateSize ( const MemberMap map) const

@MAXON_ANNOTATION{refclass=false}

◆ InitIterator()

MAXON_METHOD Result<Int> InitIterator ( ViewIteratorMember members,
const MemberMap map,
Char state,
PersistentIdBuffer idBuffer,
Bool  constAccess 
) const

@MAXON_ANNOTATION{refclass=false}

◆ ValidateIterator()

MAXON_METHOD Result<Int> ValidateIterator ( Int  index,
ViewIteratorMember members,
const MemberMap map,
Char state,
PersistentIdBuffer idBuffer 
) const

@MAXON_ANNOTATION{refclass=false}

◆ FreeIterator()

MAXON_METHOD void FreeIterator ( ViewIteratorMember members,
const MemberMap map,
Char state,
PersistentIdBuffer idBuffer 
) const

@MAXON_ANNOTATION{refclass=false}

◆ MoveIterator()

MAXON_METHOD Result<Int> MoveIterator ( Int  index,
ViewIteratorMember members,
const MemberMap map,
Char state,
PersistentIdBuffer idBuffer 
) const

@MAXON_ANNOTATION{refclass=false}

◆ AdvancePersistentId()

MAXON_METHOD Result<void> AdvancePersistentId ( Int  index,
const Char state,
PersistentIdBuffer idBuffer 
) const

@MAXON_ANNOTATION{refclass=false}

◆ MAXON_ADD_TO_CONST_REFERENCE_CLASS()

MAXON_ADD_TO_CONST_REFERENCE_CLASS ( using  Iterator = maxon::details::ContainerIterator< T, false >;using ConstIterator=maxon::details::ContainerIterator< T, true >;)

Member Data Documentation

◆ MAXON_METHOD_RESERVE

MAXON_METHOD_RESERVE