View Issue Details

IDProjectCategoryView StatusLast Update
0013596Open CASCADEOCCT:Foundation Classespublic2012-01-13 15:12
ReporteragvAssigned Toagv 
PrioritynormalSeveritytrivial 
Status closedResolutionfixed 
OSAll 
Fixed in Version6.2.0 
Summary0013596: Using C++ Namespace with Handle types
DescriptionCurrently it is impossible to define a Handle type inside a namespace.

The cause of the problem are the type declarations inside macros (file
Standard_DefineHandle.hxx):

   class Standard_Transient;
   class Standard_Persistent;
   class Handle_Standard_Type;
   class Handle_##C2;

These statements declare classes in the same namespace where the Handle class is
created, which is wrong.

The problem can be solved by avoiding the above declarations in the bodies of
macros, in file Standard_DefineHandle.hxx.
Additional information
and documentation updates
Documentation remark, added by AGV 2007-02-15 12:32:01:

New features:
none
Improvements:
With this improvement it is possible to declare transient classes in namespaces:

========== in *.H ====================
#include <Standard_DefineHandle.hxx>

namespace Foo
{
class Bar : public Standard_Transient
{
   ...
  public:
  DEFINE_STANDARD_RTTI (Bar)
}; // end of class Bar

// Definition of HANDLE object using Standard_DefineHandle.hxx
DEFINE_STANDARD_HANDLE (Bar, Standard_Transient )

} // end of namespace Foo

========== in *.CPP ====================

namespace Foo {
IMPLEMENT_STANDARD_HANDLE (Bar, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(Bar, Standard_Transient)
}

...

Foo::Handle_Bar anObject = new Foo::Bar();

using namespace Foo;

Handle(Bar) aCopyObject = anObject;

Changes:
none
Modified entities:
Standard
TagsNo tags attached.
Test case number

Attached Files

  • OCC13596.tar.gz (979 bytes)

Activities

2006-10-09 16:07

 

OCC13596.tar.gz (979 bytes)

Issue History

Date Modified Username Field Change
2006-10-12 12:51 bugmaster Assigned To bugmaster => agv
2006-10-12 12:51 bugmaster Status new => assigned
2006-10-31 16:52 bugmaster Status assigned => verified
2007-06-01 12:04 bugmaster Status verified => closed
2007-06-01 12:04 bugmaster Resolution @0@ => fixed
2011-08-02 11:23 bugmaster Category OCCT:FDC => OCCT:Foundation Classes
2012-01-13 15:12 atp Description Updated
2012-01-13 15:12 atp Additional Information Updated