///////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2002-2025, Open Design Alliance (the "Alliance").
// All rights reserved.
//
// This software and its documentation and related materials are owned by
// the Alliance. The software may only be incorporated into application
// programs owned by members of the Alliance, subject to a signed
// Membership Agreement and Supplemental Software License Agreement with the
// Alliance. The structure and organization of this software are the valuable
// trade secrets of the Alliance and its suppliers. The software is also
// protected by copyright law and international treaty provisions. Application
// programs incorporating this software must include the following statement
// with their copyright notices:
//
// This application incorporates Open Design Alliance software pursuant to a license
// agreement with Open Design Alliance.
// Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance.
// All rights reserved.
//
// By use of this software, its documentation or related materials, you
// acknowledge and accept the above terms.
///////////////////////////////////////////////////////////////////////////////
#ifndef _IFC_COMPOUND_H_
#define _IFC_COMPOUND_H_
#include "IfcBuildOptions.h"
#include "IfcEntityTypes.h"
#include "IfcFile.h"
#include "IfcEntity.h"
#include "daiCompound.h"
#include "TD_PackPush.h"
/** \details
Contains declarations related to working with IFC files content.
*/
namespace OdIfc {
/** \details
A class that implements working with an IFC compound object.
*/
class IFCCORE_EXPORT OdIfcCompound : public OdDAI::OdCompound
{
//DOM-IGNORE-BEGIN
ODRX_DECLARE_MEMBERS(OdIfcCompound);
protected:
OdIfcInstance* m_pEntInst;
//DOM-IGNORE-END
public:
/** \details
Composes the compound object into a specified model.
*/
void compose() override;
/** \details
Retrieves the current type of the compound object.
\returns An OdIfcEntityType enumeration value that represents the current compound object type.
*/
OdIfcEntityType type();
/** \details
Retrieves the current value of an attribute specified by its definition.
\param attrDef [in] A value of the OdIfcAttribute enumeration that represents the attribute definition.
\returns The current value of the attribute.
\remarks
The method provides late binding access to the attribute value by its definition.
Attributes of select and aggregate data types are also supported.
*/
OdRxValue getAttr(const OdIfcAttribute attrDef) const { return m_pEntInst->getAttr(attrDef); }
/** \details
Retrieves the current value of an attribute specified by its name.
\param attrName [in] An ANSI string that contains the attribute name.
\returns The current value of the attribute.
\remarks
The method provides late binding access to the attribute value by its name.
Attributes of select and aggregate data types are also supported.
*/
virtual OdRxValue getAttr(const OdAnsiString &attrName) const { return m_pEntInst->getAttr(attrName); }
/** \details
Retrieves the model that currently owns the compound object.
\returns A raw pointer to the OdIfcModel object representing the model that owns the entity.
*/
OdIfcModel* owningModel() const;
/** \details
Retrieves whether the compound object belongs to a specified entity type.
\param type [in] An entity type name.
\returns true if the compound object belongs to the specified type; otherwise, the method returns false.
*/
bool isKindOf(OdIfcEntityType type) const { return m_pEntInst->isKindOf(type); };
/** \details
Retrieves whether the compound object is an instance of a specified type.
\param entityType [in] An instance of the OdIfcEntityType enumeration that represents the entity type.
\returns true if the compound object is an instance of the specified type; otherwise, the method returns false.
*/
bool isInstanceOf(OdIfcEntityType entityType) const { return m_pEntInst->isInstanceOf(entityType); };
/** \details
Retrieves the name of the current compound object's type.
\returns An ANSI string value that contains the current compound object's type name.
*/
const OdAnsiString& typeName() { return m_pEntInst->typeName(); };
/** \details
Retrieves the compound object's underlying IFC entity instance.
\param compound [in] A raw pointer to the compound object.
\returns A raw pointer to the IFC instance.
*/
static const OdIfcInstance* earlyAccess(const OdIfcCompound* compound) { return compound->m_pEntInst; };
/** \details
Retrieves the owning file for the IFC entity instance.
\returns A raw pointer to the owning file.
*/
OdIfcFile* owningIfcFile() const;
/** \details
Retrieves the owning file for the STEP entity instance.
\returns A raw pointer to the owning file.
*/
OdStepFile* owningStepFile() const override;
//
// OdGiDrawable void implementation
//
/** \details
Retrieves whether the compound object is a persistent one.
\returns true if the compound object is a persistent one; otherwise, the method returns false.
\remarks
Persistent objects are database-resident objects (i.e., they are stored in a database).
*/
virtual bool isPersistent() const { return id() != NULL; };
/** \details
Retrieves the identifier of the compound object's database.
\returns A raw pointer to a stub object that provides access to the database.
\remarks
The method returns a NULL pointer if the compound object is not a persistent one.
*/
virtual OdDbStub* id() const { return m_pEntInst->m_id; };
/** \details
Retrieves the identifier of the compound object's parent item.
\returns A raw pointer to a stub object that provides access to the database.
\remarks
The method returns a NULL pointer if the compound object doesn't have parent item.
*/
virtual OdDbStub* ownerId() const;
/** \details
Allows a OdIfcCompound of a complex object to notify its database object that it has been changed.
*/
virtual void xmitPropagateModify();
//DOM-IGNORE-BEGIN
protected:
void init(OdStepFile* pFile, const char *entityName);
private:
void setInst(OdIfcInstance *pInst) { m_pEntInst = pInst; }
friend class ::OdIfcEntResolver;
//DOM-IGNORE-END
};
/** \details
A data type that represents a smart pointer to an OdIfcCompound object.
*/
typedef OdSmartPtr OdIfcCompoundPtr;
}
#include "TD_PackPop.h"
#endif // _IFC_COMPOUND_H_