opennurbs_group.cpp
Go to the documentation of this file.
00001 /* $NoKeywords: $ */
00002 /*
00003 //
00004 // Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
00005 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
00006 // McNeel & Associates.
00007 //
00008 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
00009 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
00010 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
00011 //                              
00012 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
00013 //
00015 */
00016 
00017 #include "pcl/surface/3rdparty/opennurbs/opennurbs.h"
00018 
00019 ON_OBJECT_IMPLEMENT( ON_Group, ON_Object, "721D9F97-3645-44c4-8BE6-B2CF697D25CE" );
00020 
00021 ON_Group::ON_Group() : m_group_index(-1)
00022 {
00023   memset(&m_group_id,0,sizeof(m_group_id));
00024 }
00025 
00026 ON_Group::~ON_Group()
00027 {
00028 }
00029 
00031 //
00032 // ON_Object overrides
00033 
00034 ON_BOOL32 ON_Group::IsValid( ON_TextLog* text_log ) const
00035 {
00036   return ( m_group_name.Length() > 0 && m_group_index >= 0 );
00037 }
00038 
00039 void ON_Group::Dump( ON_TextLog& dump ) const
00040 {
00041   const wchar_t* name = GroupName();
00042   if ( !name )
00043     name = L"";
00044   dump.Print("group index = %d\n",m_group_index);
00045   dump.Print("group name = \"%ls\"\n",name);
00046 }
00047 
00048 ON_BOOL32 ON_Group::Write(
00049        ON_BinaryArchive& file // serialize definition to binary archive
00050      ) const
00051 {
00052   ON_BOOL32 rc = file.Write3dmChunkVersion(1,1);
00053   // version 1.0 fields
00054   if (rc) rc = file.WriteInt(m_group_index);
00055   if (rc) rc = file.WriteString(m_group_name);
00056   // version 1.1 fields
00057   if (rc) rc = file.WriteUuid(m_group_id);
00058   return rc;
00059 }
00060 
00061 ON_BOOL32 ON_Group::Read(
00062        ON_BinaryArchive& file // restore definition from binary archive
00063      )
00064 {
00065   m_group_index = -1;
00066   m_group_name.Empty();
00067   memset(&m_group_id,0,sizeof(m_group_id));
00068   int major_version = 0;
00069   int minor_version = 0;
00070   ON_BOOL32 rc = file.Read3dmChunkVersion(&major_version,&minor_version);
00071   if ( major_version == 1 ) 
00072   {
00073     if (rc) rc = file.ReadInt( &m_group_index );
00074     if (rc) rc = file.ReadString( m_group_name );
00075     if ( minor_version >= 1 )
00076     {
00077       if (rc) rc = file.ReadUuid( m_group_id );
00078     }
00079   }
00080   else
00081     rc = false;
00082   return rc;
00083 }
00084 
00086 //
00087 // Interface
00088 void ON_Group::SetGroupName( const wchar_t* s )
00089 {
00090   m_group_name = s;
00091 }
00092 
00093 void ON_Group::SetGroupName( const char* s )
00094 {
00095   m_group_name = s;
00096 }
00097 
00098 void ON_Group::GetGroupName( ON_wString& s ) const
00099 {
00100   s = m_group_name;
00101 }
00102 
00103 const wchar_t* ON_Group::GroupName() const
00104 {
00105   const wchar_t* s = m_group_name;
00106   return s;
00107 }
00108 
00109 void ON_Group::SetGroupIndex(int i )
00110 {
00111   m_group_index = i;
00112 }
00113 
00114 int ON_Group::GroupIndex() const
00115 {
00116   return m_group_index;
00117 }
00118 


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:27:01