simple API for reading/writing data */
| 5040 | |
| 5041 | /* simple API for reading/writing data */ |
| 5042 | CV_IMPL void |
| 5043 | cvSave( const char* filename, const void* struct_ptr, |
| 5044 | const char* _name, const char* comment, CvAttrList attributes ) |
| 5045 | { |
| 5046 | CvFileStorage* fs = 0; |
| 5047 | |
| 5048 | if( !struct_ptr ) |
| 5049 | CV_Error( CV_StsNullPtr, "NULL object pointer" ); |
| 5050 | |
| 5051 | fs = cvOpenFileStorage( filename, 0, CV_STORAGE_WRITE ); |
| 5052 | if( !fs ) |
| 5053 | CV_Error( CV_StsError, "Could not open the file storage. Check the path and permissions" ); |
| 5054 | |
| 5055 | cv::string name = _name ? cv::string(_name) : cv::FileStorage::getDefaultObjectName(filename); |
| 5056 | |
| 5057 | if( comment ) |
| 5058 | cvWriteComment( fs, comment, 0 ); |
| 5059 | cvWrite( fs, name.c_str(), struct_ptr, attributes ); |
| 5060 | cvReleaseFileStorage( &fs ); |
| 5061 | } |
| 5062 | |
| 5063 | CV_IMPL void* |
| 5064 | cvLoad( const char* filename, CvMemStorage* memstorage, |
nothing calls this directly
no test coverage detected