//
#include "Driver_Mesh.h"
+#include "SMESH_Comment.hxx"
+
#include <utilities.h>
using namespace std;
Driver_Mesh::Driver_Mesh():
myFile(""),
- myMeshId(-1)
+ myMeshId(-1),
+ myStatus( DRS_OK )
{}
#ifdef _DEBUG_
cout << msg << endl;
#endif
- return isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM;
+ return ( myStatus = isFatal ? DRS_FAIL : DRS_WARN_SKIP_ELEM );
+}
+
+//================================================================================
+/*!
+ * \brief Return a structure containing description of errors
+ */
+//================================================================================
+
+SMESH_ComputeErrorPtr Driver_Mesh::GetError()
+{
+ SMESH_Comment msg;
+ for ( size_t i = 0; i < myErrorMessages.size(); ++i )
+ {
+ msg << myErrorMessages[i];
+ if ( i+1 < myErrorMessages.size() )
+ msg << "\n";
+ }
+ return SMESH_ComputeError::New( myStatus == DRS_OK ? int(COMPERR_OK) : int(myStatus), msg );
}
#ifndef _INCLUDE_DRIVER_MESH
#define _INCLUDE_DRIVER_MESH
+#include "SMESH_ComputeError.hxx"
+
#include <string>
#include <vector>
DRS_FAIL // general failure (exception etc.)
};
- virtual Status Perform() = 0;
- void SetMeshId(int theMeshId);
- void SetFile(const std::string& theFileName);
- virtual void SetMeshName(const std::string& theMeshName);
+ void SetMeshId(int theMeshId);
+ void SetFile(const std::string& theFileName);
+ virtual void SetMeshName(const std::string& theMeshName);
virtual std::string GetMeshName() const;
+ virtual void SetOption(const std::string& optionName,
+ const std::string& optionValue) {}
+
+ virtual Status Perform() = 0;
+
+ virtual SMESH_ComputeErrorPtr GetError();
+
protected:
std::string myFile;
std::string myMeshName;
- int myMeshId;
+ int myMeshId;
Status addMessage(const std::string& msg, const bool isFatal=false);
std::vector< std::string > myErrorMessages;
+ Status myStatus;
};
#endif