opennurbs_pluginlist.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_PlugInRef::ON_PlugInRef()
00020 {
00021   Default();
00022 }
00023 
00024 void ON_PlugInRef::Default()
00025 {
00026   memset(&m_plugin_id,0,sizeof(m_plugin_id));
00027   m_plugin_type = 0;
00028   m_plugin_platform = 0;
00029   m_plugin_sdk_version = 0;
00030   m_plugin_sdk_service_release = 0;
00031   m_plugin_name.Destroy();
00032   m_plugin_version.Destroy();
00033   m_plugin_filename.Destroy(); // name of executable file
00034 
00035   m_developer_organization.Destroy();
00036   m_developer_address.Destroy();
00037   m_developer_country.Destroy();
00038   m_developer_phone.Destroy();
00039   m_developer_email.Destroy();
00040   m_developer_website.Destroy();
00041   m_developer_updateurl.Destroy();
00042   m_developer_fax.Destroy();
00043 }
00044 
00045 bool ON_PlugInRef::Write( ON_BinaryArchive& file ) const
00046 {
00047   bool rc = file.BeginWrite3dmChunk(TCODE_ANONYMOUS_CHUNK,1,2);
00048   if (rc)
00049   {
00050     //version 1.0 fields
00051     if (rc) rc = file.WriteUuid(m_plugin_id);
00052     if (rc) rc = file.WriteInt(m_plugin_type);
00053     if (rc) rc = file.WriteString(m_plugin_name);
00054     if (rc) rc = file.WriteString(m_plugin_version);
00055     if (rc) rc = file.WriteString(m_plugin_filename);
00056 
00057     // version 1.1 fields 
00058     if (rc) rc = file.WriteString(m_developer_organization);
00059     if (rc) rc = file.WriteString(m_developer_address);
00060     if (rc) rc = file.WriteString(m_developer_country);
00061     if (rc) rc = file.WriteString(m_developer_phone);
00062     if (rc) rc = file.WriteString(m_developer_email);
00063     if (rc) rc = file.WriteString(m_developer_website);
00064     if (rc) rc = file.WriteString(m_developer_updateurl);
00065     if (rc) rc = file.WriteString(m_developer_fax);
00066 
00067     // version 1.2 fields
00068     if (rc) rc = file.WriteInt(m_plugin_platform);
00069     if (rc) rc = file.WriteInt(m_plugin_sdk_version);
00070     if (rc) rc = file.WriteInt(m_plugin_sdk_service_release);
00071 
00072     if( !file.EndWrite3dmChunk() )
00073       rc = false;
00074   }
00075   return rc;
00076 }
00077 
00078 void ON_PlugInRef::Dump(ON_TextLog& text_log) const
00079 {
00080   text_log.Print("Plug-in executable information:\n");
00081   text_log.PushIndent();
00082   text_log.Print("id = ");text_log.Print(m_plugin_id);text_log.Print("\n");
00083   text_log.Print("type = %d\n",m_plugin_type);
00084   text_log.Print("platform = %d\n",m_plugin_platform);
00085   text_log.Print("sdk version = %d.%d\n",m_plugin_sdk_version,m_plugin_sdk_service_release);
00086   text_log.Print("name = "); text_log.Print(m_plugin_name); text_log.Print("\n");
00087   text_log.Print("version = "); text_log.Print(m_plugin_version); text_log.Print("\n");
00088   text_log.Print("file name = "); text_log.Print(m_plugin_filename); text_log.Print("\n");
00089   text_log.PopIndent();
00090 
00091   text_log.Print("Developer information:\n");
00092   text_log.PushIndent();
00093   text_log.Print("website url = ");text_log.Print(m_developer_website); text_log.Print("\n");
00094   text_log.Print("update url = ");text_log.Print(m_developer_updateurl); text_log.Print("\n");
00095   text_log.Print("organization = ");text_log.Print(m_developer_organization); text_log.Print("\n");
00096   text_log.Print("address = ");text_log.Print(m_developer_address); text_log.Print("\n");
00097   text_log.Print("country = ");text_log.Print(m_developer_country); text_log.Print("\n");
00098   text_log.Print("voice = ");text_log.Print(m_developer_phone); text_log.Print("\n");
00099   text_log.Print("email = ");text_log.Print(m_developer_email); text_log.Print("\n");
00100   text_log.Print("fax = ");text_log.Print(m_developer_fax); text_log.Print("\n");
00101   text_log.PopIndent();
00102 
00103 }
00104 
00105 
00106 bool ON_PlugInRef::Read( ON_BinaryArchive& file )
00107 {
00108   Default();
00109 
00110   int major_version = 0;
00111   int minor_version = 0;
00112 
00113   bool rc = file.BeginRead3dmChunk(
00114                   TCODE_ANONYMOUS_CHUNK,
00115                   &major_version,
00116                   &minor_version);
00117 
00118   if (rc)
00119   {
00120     if( 1 == major_version && minor_version >= 0 )
00121     {
00122       //version 1.0 fields
00123       if (rc) rc = file.ReadUuid(m_plugin_id);
00124       if (rc) rc = file.ReadInt(&m_plugin_type);
00125       if (rc) rc = file.ReadString(m_plugin_name);
00126       if (rc) rc = file.ReadString(m_plugin_version);
00127       if (rc) rc = file.ReadString(m_plugin_filename);
00128 
00129       if ( minor_version >= 1)
00130       {
00131         // version 1.1 fields
00132         if (rc) rc = file.ReadString(m_developer_organization);
00133         if (rc) rc = file.ReadString(m_developer_address);
00134         if (rc) rc = file.ReadString(m_developer_country);
00135         if (rc) rc = file.ReadString(m_developer_phone);
00136         if (rc) rc = file.ReadString(m_developer_email);
00137         if (rc) rc = file.ReadString(m_developer_website);
00138         if (rc) rc = file.ReadString(m_developer_updateurl);
00139         if (rc) rc = file.ReadString(m_developer_fax);
00140 
00141         if ( minor_version >= 2 )
00142         {
00143           if (rc) rc = file.ReadInt(&m_plugin_platform);
00144           if (rc) rc = file.ReadInt(&m_plugin_sdk_version);
00145           if (rc) rc = file.ReadInt(&m_plugin_sdk_service_release);
00146         }
00147       }
00148     }
00149     else
00150     {
00151       rc = false;
00152     }
00153 
00154     if( !file.EndRead3dmChunk() )
00155       rc = false;
00156   }
00157   return rc;
00158 }
00159 
00160 


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