#include <opennurbs_archive.h>

Public Types

enum  : int { UnsetComponentIndex = ON_UNSET_INT_INDEX }
 

Public Member Functions

 ON_ComponentManifest () ON_NOEXCEPT
 
 ~ON_ComponentManifest ()
 
unsigned int ActiveAndDeletedComponentCount (ON_ModelComponent::Type component_type) const
 
unsigned int ActiveComponentCount (ON_ModelComponent::Type component_type) const
 
const class ON_ComponentManifestItemAddComponentToManifest (const class ON_ModelComponent &component, bool bResolveIdAndNameCollisions, ON_wString *assigned_name)
 Add a component to this manifest. If the id is not set or not unique, the component will not be added. If a unique name is required and the name is not set or not unique, the component will not be added. More...
 
const class ON_ComponentManifestItemAddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_id, const ON_NameHash &component_name_hash)
 Add a component to this manifest. More...
 
const class ON_ComponentManifestItemAddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_parent_id, ON_UUID component_id, const ON_NameHash &component_name_hash, const wchar_t *candidate_name, ON_wString &assigned_name)
 Add a component to this manifest. If the id is not set or in use, then a new one will be assigned. If the component type requires a unique name and the name is not set or in use, then a new one will be assigned. More...
 
const class ON_ComponentManifestItemAddComponentToManifest (ON_ModelComponent::Type component_type, ON__UINT64 component_serial_number, ON_UUID component_parent_id, ON_UUID component_id, const wchar_t *original_name, ON_wString &assigned_name)
 
const class ON_ComponentManifestItemAddSystemComponentToManifest (const class ON_ModelComponent &component)
 
const class ON_ComponentManifestItemChangeComponentName (ON_UUID item_id, ON_ModelComponent::Type component_type, ON_UUID component_parent_id, const wchar_t *component_name)
 Modify a manifest items's component name More...
 
const class ON_ComponentManifestItemChangeComponentName (const class ON_ModelComponent &component)
 Modify a manifest items's component name More...
 
const class ON_ComponentManifestItemChangeComponentNameHash (ON_UUID item_id, const ON_NameHash &component_name_hash)
 A function for expert users to directly set the component's name hash. Generally, it is better to use the ChangeComponentName() functions. More...
 
const class ON_ComponentManifestItemChangeComponentRuntimeSerialNumber (ON_UUID item_id, ON__UINT64 component_runtime_serial_number)
 Modify a manifest items's component m_component_runtime_serial_number, m_original_index, m_original_id, and m_name_hash values. More...
 
int ComponentIndexLimit (ON_ModelComponent::Type component_type) const
 
const class ON_ComponentManifestItemDeleteComponent (ON_UUID item_id)
 Set a component's status to deleted. More...
 
const class ON_ComponentManifestItemDeleteComponent (ON__UINT64 component_runtime_serial_number)
 
unsigned int DeletedComponentCount (ON_ModelComponent::Type component_type) const
 
const class ON_ComponentManifestItemFirstItem (ON_ModelComponent::Type component_type) const
 
bool IdIsAvailable (ON_UUID id) const
 
unsigned int ItemCount () const
 Total number of items in the manifest, including items referencing system components and deleted items. More...
 
const class ON_ComponentManifestItemItemFromComponentRuntimeSerialNumber (ON__UINT64 component_runtime_serial_number) const
 
const class ON_ComponentManifestItemItemFromId (ON_UUID item_id) const
 
const class ON_ComponentManifestItemItemFromId (ON_ModelComponent::Type component_type, ON_UUID item_id) const
 Returns the item if it has the required component type and id. More...
 
const class ON_ComponentManifestItemItemFromIndex (ON_ModelComponent::Type component_type, int item_index) const
 
const class ON_ComponentManifestItemItemFromName (const class ON_ModelComponent *model_component) const
 
const class ON_ComponentManifestItemItemFromName (ON_ModelComponent::Type component_type, ON_UUID parent_id, const wchar_t *name) const
 
const class ON_ComponentManifestItemItemFromNameHash (ON_ModelComponent::Type component_type, const ON_NameHash &component_name_hash) const
 
const class ON_ComponentManifestItemItemFromUnsignedIndex (ON_ModelComponent::Type component_type, unsigned int unsigned_item_index) const
 
const class ON_ComponentManifestItemLastItem (ON_ModelComponent::Type component_type) const
 
ON__UINT64 ManifestContentVersionNumber () const
 This number is incremented every time the manifest changes. More...
 
bool NameIsAvailable (ON_ModelComponent::Type component_type, const ON_NameHash &candidate_name_hash) const
 
const class ON_ComponentManifestItemNextItem (const class ON_ComponentManifestItem *item) const
 
const class ON_ComponentManifestItemNextItem (ON_UUID manifest_item_id) const
 
const class ON_ComponentManifestItemPreviousItem (const class ON_ComponentManifestItem *item) const
 
const class ON_ComponentManifestItemPreviousItem (ON_UUID manifest_item_id) const
 
bool RemoveAllComponents (ON_ModelComponent::Type component_type, bool bResetManifestIndex)
 
bool RemoveComponent (const ON_ModelComponent &component)
 
bool RemoveComponent (ON__UINT64 component_runtime_serial_number)
 
bool RemoveComponent (ON_UUID item_id)
 
bool RemoveIndexedComponent (ON_ModelComponent::Type component_type, int item_index)
 
void Reset ()
 
unsigned int SystemComponentCount (ON_ModelComponent::Type component_type) const
 
const class ON_ComponentManifestItemSystemItemFromIndex (ON_ModelComponent::Type component_type, int system_item_index) const
 
const class ON_ComponentManifestItemSystemItemFromNameHash (ON_ModelComponent::Type component_type, const ON_NameHash &system_item_name_hash) const
 
unsigned int TotalComponentCount (ON_ModelComponent::Type component_type) const
 
const class ON_ComponentManifestItemUndeleteComponent (ON_UUID item_id, ON_UUID parent_id, const wchar_t *candidate_name, ON_wString &assigned_name)
 Undelete a previously deleted component. More...
 
const class ON_ComponentManifestItemUndeleteComponentAndChangeRuntimeSerialNumber (ON_UUID item_id, ON_UUID parent_id, ON__UINT64 new_component_runtime_serial_number, const wchar_t *candidate_name, ON_wString &assigned_name)
 Undelete a previously deleted component with the same id and change the serial number to new_component_runtime_serial_number. More...
 
ON_UUID UnusedId (ON_UUID candidate_id) const
 Get an id that is not currently used in this manifest More...
 
const ON_wString UnusedName (ON_ModelComponent::Type component_type, ON_UUID component_parent_id, const wchar_t *candidate_name, const wchar_t *base_name, const wchar_t *suffix_separator, unsigned int suffix0, unsigned int *suffix_value) const
 Get a name that is currently not used in this manifest as either a component or manifest name. More...
 
const ON_wString UnusedName (const ON_ModelComponent &model_component) const
 Get a name that is currently not used in this manifest as either a component or manifest name. More...
 

Static Public Attributes

static const ON_ComponentManifest Empty
 

Member Enumeration Documentation

◆ anonymous enum

anonymous enum : int
Enumerator
UnsetComponentIndex 

Constructor & Destructor Documentation

◆ ON_ComponentManifest()

ON_ComponentManifest::ON_ComponentManifest ( )

◆ ~ON_ComponentManifest()

ON_ComponentManifest::~ON_ComponentManifest ( )

Member Function Documentation

◆ ActiveAndDeletedComponentCount()

unsigned int ON_ComponentManifest::ActiveAndDeletedComponentCount ( ON_ModelComponent::Type  component_type) const
Parameters
component_type[in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted.
Returns
Number of model components of the specified type in this manifest.

The count includes active and deleted components. The count does not include system components (those added by calling AddSystemComponentToManifest()).

◆ ActiveComponentCount()

unsigned int ON_ComponentManifest::ActiveComponentCount ( ON_ModelComponent::Type  component_type) const
Parameters
component_type[in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted.
Returns
Number of active model components of the specified type in this manifest.

The count does not include deleted components (IsDeleted() = true). The count does not include system components (those added by calling AddSystemComponentToManifest()).

◆ AddComponentToManifest() [1/4]

const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest ( const class ON_ModelComponent component,
bool  bResolveIdAndNameCollisions,
ON_wString assigned_name 
)

Add a component to this manifest. If the id is not set or not unique, the component will not be added. If a unique name is required and the name is not set or not unique, the component will not be added.

Parameters
component[in] If you want to update the component id, index and name values to match the ones assigned in the manifest, then call component.SetIdentification(manifest_item), where manifest_item is the information returned by this function.
bResolveIdAndNameCollisions[in] If false, then the component parameter id must not be used in the manifest and, when required, the name must be set and unique. If true and a new id or name is required, one will be assigned. Note that the component parameter is const and its id and name are not modified.
assigned_name[out] If not null, the assigned name is returned here.
Returns
If an item is added to this manifest, then the assigned identification information is returned. Otherwise ON_ComponentManifestItem::Unset is returned. Note the manifest index is generally different from component.Index().

Use

◆ AddComponentToManifest() [2/4]

const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest ( ON_ModelComponent::Type  component_type,
ON__UINT64  component_serial_number,
ON_UUID  component_id,
const ON_NameHash component_name_hash 
)

Add a component to this manifest.

Parameters
component_type[in] Type of component.
component_serial_number[in] 0 or the component's unique runtime serial number (ON_ModelComponent::RuntimeSerialNumber()).
component_id[in]
component_name_hash[in] If the the component type requires a unique name and the name is not valid or in use, the component will not be added.
Returns
If an item is added to this manifest, then the identification information is returned. Otherwise ON_ComponentManifestItem::Unset is returned. Note: The manifest index is assigned to components that require an index.

◆ AddComponentToManifest() [3/4]

const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest ( ON_ModelComponent::Type  component_type,
ON__UINT64  component_serial_number,
ON_UUID  component_parent_id,
ON_UUID  component_id,
const ON_NameHash component_name_hash,
const wchar_t *  candidate_name,
ON_wString assigned_name 
)

Add a component to this manifest. If the id is not set or in use, then a new one will be assigned. If the component type requires a unique name and the name is not set or in use, then a new one will be assigned.

Parameters
component_type[in] Type of component.
component_serial_number[in] 0 or the component's unique runtime serial number (ON_ModelComponent::RuntimeSerialNumber()).
component_id[in] If the id is nil or in use, a new id will be assigned.
component_name_hash[in] If the the component type requires a unique name and the name is not valid or in use, the component will not be added.
original_name[in/out] If a new name needs to be assigned, the input value will be used as a candidate and then as the root. Passing in the current name is a good choice. The output value is the final assigned name.
Returns
If an item is added to this manifest, then the identification information is returned. Otherwise ON_ComponentManifestItem::Unset is returned.

◆ AddComponentToManifest() [4/4]

const class ON_ComponentManifestItem& ON_ComponentManifest::AddComponentToManifest ( ON_ModelComponent::Type  component_type,
ON__UINT64  component_serial_number,
ON_UUID  component_parent_id,
ON_UUID  component_id,
const wchar_t *  original_name,
ON_wString assigned_name 
)

◆ AddSystemComponentToManifest()

const class ON_ComponentManifestItem& ON_ComponentManifest::AddSystemComponentToManifest ( const class ON_ModelComponent component)

◆ ChangeComponentName() [1/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentName ( ON_UUID  item_id,
ON_ModelComponent::Type  component_type,
ON_UUID  component_parent_id,
const wchar_t *  component_name 
)

Modify a manifest items's component name

Parameters
item_id[in] Identifies the manifest item to modify.
component_parent_id[in] ON_ModelComponent.ParentId() value. When ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, it is critical that component_parent_id be set correctly.
name[in] new name
Returns
True if name was modified.

◆ ChangeComponentName() [2/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentName ( const class ON_ModelComponent component)

Modify a manifest items's component name

Parameters
component[in] The component that is in the manifest with the new name set.
Returns
True if name was modified.

◆ ChangeComponentNameHash()

const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentNameHash ( ON_UUID  item_id,
const ON_NameHash component_name_hash 
)

A function for expert users to directly set the component's name hash. Generally, it is better to use the ChangeComponentName() functions.

Parameters
item_id[in] Identifies the manifest item to modify.
component_name_hash[in] new name hash

◆ ChangeComponentRuntimeSerialNumber()

const class ON_ComponentManifestItem& ON_ComponentManifest::ChangeComponentRuntimeSerialNumber ( ON_UUID  item_id,
ON__UINT64  component_runtime_serial_number 
)

Modify a manifest items's component m_component_runtime_serial_number, m_original_index, m_original_id, and m_name_hash values.

Parameters
manifest_id[in] identifies the manifest item to modify
component_runtime_serial_number[in]

◆ ComponentIndexLimit()

int ON_ComponentManifest::ComponentIndexLimit ( ON_ModelComponent::Type  component_type) const
Parameters
component_type[in]
Returns
If the component type is indexed, then all current manifest indices for the component_type are >= 0 and < ComponentIndexLimit(). Otherwise 0 is returned.

◆ DeleteComponent() [1/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::DeleteComponent ( ON_UUID  item_id)

Set a component's status to deleted.

◆ DeleteComponent() [2/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::DeleteComponent ( ON__UINT64  component_runtime_serial_number)

◆ DeletedComponentCount()

unsigned int ON_ComponentManifest::DeletedComponentCount ( ON_ModelComponent::Type  component_type) const
Parameters
component_type[in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted.
Returns
Number of model components of the specified type in this manifest that have IsDeleted() = true.

System components cannot be deleted.

◆ FirstItem()

const class ON_ComponentManifestItem* ON_ComponentManifest::FirstItem ( ON_ModelComponent::Type  component_type) const

◆ IdIsAvailable()

bool ON_ComponentManifest::IdIsAvailable ( ON_UUID  id) const
Returns
True if the id is valid and currently not used in this ON_Manifest as either a component or a manifest id value.

◆ ItemCount()

unsigned int ON_ComponentManifest::ItemCount ( ) const

Total number of items in the manifest, including items referencing system components and deleted items.

◆ ItemFromComponentRuntimeSerialNumber()

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromComponentRuntimeSerialNumber ( ON__UINT64  component_runtime_serial_number) const

◆ ItemFromId() [1/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromId ( ON_UUID  item_id) const

◆ ItemFromId() [2/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromId ( ON_ModelComponent::Type  component_type,
ON_UUID  item_id 
) const

Returns the item if it has the required component type and id.

Every item has a unique manifest id. The component_type parameter is provided if an additional check needs to be made on component type.

◆ ItemFromIndex()

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromIndex ( ON_ModelComponent::Type  component_type,
int  item_index 
) const

◆ ItemFromName() [1/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromName ( const class ON_ModelComponent model_component) const
Parameters
component_type[in]
component_name_hash[in] The value of ON_ModelComponent::UniqueNameIgnoresCase(component_type) must be used when creating the name hash (group names are case sensitive).

If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, then the parent_id must be used to calculate the name hash (layer names require parent ids).

◆ ItemFromName() [2/2]

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromName ( ON_ModelComponent::Type  component_type,
ON_UUID  parent_id,
const wchar_t *  name 
) const

◆ ItemFromNameHash()

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromNameHash ( ON_ModelComponent::Type  component_type,
const ON_NameHash component_name_hash 
) const
Parameters
component_type[in]
component_name_hash[in] The value of ON_ModelComponent::UniqueNameIgnoresCase(component_type) must be used when creating the name hash (group names are case sensitive).

If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true, then the parent_id must be used to calculate the name hash (layer names require parent ids).

◆ ItemFromUnsignedIndex()

const class ON_ComponentManifestItem& ON_ComponentManifest::ItemFromUnsignedIndex ( ON_ModelComponent::Type  component_type,
unsigned int  unsigned_item_index 
) const

◆ LastItem()

const class ON_ComponentManifestItem* ON_ComponentManifest::LastItem ( ON_ModelComponent::Type  component_type) const

◆ ManifestContentVersionNumber()

ON__UINT64 ON_ComponentManifest::ManifestContentVersionNumber ( ) const

This number is incremented every time the manifest changes.

◆ NameIsAvailable()

bool ON_ComponentManifest::NameIsAvailable ( ON_ModelComponent::Type  component_type,
const ON_NameHash candidate_name_hash 
) const
Parameters
component_type[in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true or false will be returned.
candidate_name_hash[in] candidate_name_hash.IsValidAndNotEmpty() must be true or false will be returned.
Returns
True if the candidate_name_hash a hash of a valid, non-empty name and the name is currently not used as either a component or manifest name value.

◆ NextItem() [1/2]

const class ON_ComponentManifestItem* ON_ComponentManifest::NextItem ( const class ON_ComponentManifestItem item) const
Returns
Next item in the manifest with the same component type.

◆ NextItem() [2/2]

const class ON_ComponentManifestItem* ON_ComponentManifest::NextItem ( ON_UUID  manifest_item_id) const
Returns
Next item in the manifest with the same component type.

◆ PreviousItem() [1/2]

const class ON_ComponentManifestItem* ON_ComponentManifest::PreviousItem ( const class ON_ComponentManifestItem item) const
Returns
Previous item in the manifest with the same component type.

◆ PreviousItem() [2/2]

const class ON_ComponentManifestItem* ON_ComponentManifest::PreviousItem ( ON_UUID  manifest_item_id) const
Returns
Previous item in the manifest with the same component type.

◆ RemoveAllComponents()

bool ON_ComponentManifest::RemoveAllComponents ( ON_ModelComponent::Type  component_type,
bool  bResetManifestIndex 
)

◆ RemoveComponent() [1/3]

bool ON_ComponentManifest::RemoveComponent ( const ON_ModelComponent component)

◆ RemoveComponent() [2/3]

bool ON_ComponentManifest::RemoveComponent ( ON__UINT64  component_runtime_serial_number)

◆ RemoveComponent() [3/3]

bool ON_ComponentManifest::RemoveComponent ( ON_UUID  item_id)

◆ RemoveIndexedComponent()

bool ON_ComponentManifest::RemoveIndexedComponent ( ON_ModelComponent::Type  component_type,
int  item_index 
)

◆ Reset()

void ON_ComponentManifest::Reset ( )

◆ SystemComponentCount()

unsigned int ON_ComponentManifest::SystemComponentCount ( ON_ModelComponent::Type  component_type) const

◆ SystemItemFromIndex()

const class ON_ComponentManifestItem& ON_ComponentManifest::SystemItemFromIndex ( ON_ModelComponent::Type  component_type,
int  system_item_index 
) const

◆ SystemItemFromNameHash()

const class ON_ComponentManifestItem& ON_ComponentManifest::SystemItemFromNameHash ( ON_ModelComponent::Type  component_type,
const ON_NameHash system_item_name_hash 
) const

◆ TotalComponentCount()

unsigned int ON_ComponentManifest::TotalComponentCount ( ON_ModelComponent::Type  component_type) const
Parameters
component_type[in] If component_type is ON_ModelComponent::Type::Unset or ON_ModelComponent::Type::Mixed, then the every explict component type is counted.
Returns
Total number of model components of the specified type in this manifest.

The count includes active, deleted, and system components.

◆ UndeleteComponent()

const class ON_ComponentManifestItem& ON_ComponentManifest::UndeleteComponent ( ON_UUID  item_id,
ON_UUID  parent_id,
const wchar_t *  candidate_name,
ON_wString assigned_name 
)

Undelete a previously deleted component.

◆ UndeleteComponentAndChangeRuntimeSerialNumber()

const class ON_ComponentManifestItem& ON_ComponentManifest::UndeleteComponentAndChangeRuntimeSerialNumber ( ON_UUID  item_id,
ON_UUID  parent_id,
ON__UINT64  new_component_runtime_serial_number,
const wchar_t *  candidate_name,
ON_wString assigned_name 
)

Undelete a previously deleted component with the same id and change the serial number to new_component_runtime_serial_number.

Often when an object is modified, the original and new object have the same id but different serial numbers. The original is deleted. When the item is undeleted for the object, the runtime serial number needs to be udated.

◆ UnusedId()

ON_UUID ON_ComponentManifest::UnusedId ( ON_UUID  candidate_id) const

Get an id that is not currently used in this manifest

Parameters
component_type[in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true. candidate_id If candidate_id is valid component id and not in use, then its value is returned.
Returns
An id that is valid and currently not used in this ON_Manifest as either a component or a manifest id value.

If candidate_id cannot be used, then ON_CreateId() is used to create a new id.

◆ UnusedName() [1/2]

const ON_wString ON_ComponentManifest::UnusedName ( ON_ModelComponent::Type  component_type,
ON_UUID  component_parent_id,
const wchar_t *  candidate_name,
const wchar_t *  base_name,
const wchar_t *  suffix_separator,
unsigned int  suffix0,
unsigned int *  suffix_value 
) const

Get a name that is currently not used in this manifest as either a component or manifest name.

Parameters
component_type[in] ON_ModelComponent::ComponentTypeIsValidAndNotMixed(component_type) must be true.
component_parent_id[in] If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true and candidate_name is not empty, then the component parent id must be accurate. This is the case for ON_Layer names. Otherwise, you may pass ON_nil_uuid.
candidate_name[in] If candidate_name is a valid and not it use, then unused_component_name = candidate_name. If ON_ModelComponent::UniqueNameIncludesParent(component_type) is true and candidate_name is not empty, then component_parent_id must be accurate. This is the case for ON_Layer names.
base_name[in] If base_name is empty or not valid, then ON_ModelComponent::ComponentTypeToString(component_type) is used as base_name
suffix_separator[in] empty or the string to place between base_name and the suffix when searching for an unsued name.
suffix0[in] If a suffix needs to be appended, the search for a unused name begins with the suffix values suffix0+1.
suffix_value[out] If nullptr != suffix_value, the value used to generate the unique name suffix is returned.
Returns
An component name that is not used in this manifest.

If candidate_name could not be used, then it has the form base_name + suffix_separator + X, where X is an integer > suffix0.

◆ UnusedName() [2/2]

const ON_wString ON_ComponentManifest::UnusedName ( const ON_ModelComponent model_component) const

Get a name that is currently not used in this manifest as either a component or manifest name.

Parameters
model_component[in] The component type, id, parent id, and candidate name parameters for the more complicated version of UnusedName() are taken from this parameter.
Returns
An component name that is not used in this manifest.

If candidate_name could not be used, then it has the form base_name + suffix_separator + X, where X is an integer > suffix0.

Member Data Documentation

◆ Empty

const ON_ComponentManifest ON_ComponentManifest::Empty
static