Skip to content

Commit

Permalink
E57SimpleWriter: Pass file guid as constructor argument
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Stewart committed Sep 27, 2022
1 parent de4f32a commit 6ed6b3e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion include/E57SimpleWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ namespace e57
//! @brief This function is the constructor for the writer class
//! @param [in] filePath file path to E57 file
//! @param [in] coordinateMetaData Information describing the Coordinate Reference System to be used for the file
Writer( const ustring &filePath, const ustring &coordinateMetaData = {} );
Writer( const ustring &filePath, const ustring &coordinateMetaData = {}, const ustring &guid = {} );

//! @brief This function returns true if the file is open
bool IsOpen() const;
Expand Down
4 changes: 2 additions & 2 deletions src/E57SimpleWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
namespace e57
{

Writer::Writer( const ustring &filePath, const ustring &coordinateMetaData ) :
impl_( new WriterImpl( filePath, coordinateMetaData ) )
Writer::Writer( const ustring &filePath, const ustring &coordinateMetaData, const ustring &guid ) :
impl_( new WriterImpl( filePath, coordinateMetaData, guid ) )
{
}

Expand Down
11 changes: 9 additions & 2 deletions src/WriterImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
namespace e57
{

WriterImpl::WriterImpl( const ustring &filePath, const ustring &coordinateMetadata ) :
WriterImpl::WriterImpl( const ustring &filePath, const ustring &coordinateMetadata, const ustring &guid ) :
imf_( filePath, "w" ), root_( imf_.root() ), data3D_( imf_, true ), images2D_( imf_, true )
{
// We are using the E57 v1.0 data format standard fieldnames.
Expand All @@ -44,7 +44,14 @@ namespace e57
// Set per-file properties.
// Path names: "/formatName", "/majorVersion", "/minorVersion", "/coordinateMetadata"
root_.set( "formatName", StringNode( imf_, "ASTM E57 3D Imaging Data File" ) );
root_.set( "guid", StringNode( imf_, generateRandomGUID() ) );
if (guid.length())
{
root_.set( "guid", StringNode( imf_, guid ) );
}
else
{
root_.set( "guid", StringNode( imf_, generateRandomGUID() ) );
}

// Get ASTM version number supported by library, so can write it into file
int astmMajor;
Expand Down
2 changes: 1 addition & 1 deletion src/WriterImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace e57
class WriterImpl
{
public:
WriterImpl( const ustring &filePath, const ustring &coordinateMetaData );
WriterImpl( const ustring &filePath, const ustring &coordinateMetaData, const ustring &guid );

~WriterImpl();

Expand Down

0 comments on commit 6ed6b3e

Please sign in to comment.