[ome-devel] Saving File attachements to an Image in C++

Jerome Avondo jeromeavondo at msn.com
Tue Jun 8 11:11:57 BST 2010


Hi all,

I am trying to save a movie file to an image via the C++ API. I have code to do this in Java so I am trying to reproduce this functionality in C++ but am struggling....

My code logic is as follows,

 omero::model::OriginalFilePtr originalFile = new omero::model::OriginalFileI();

 //omero::model::FormatPtr f = (omero::model::FormatPtr&)query->findByString("omero.model.Format", "value", "video/mpeg");
 omero::model::FormatPtr f = (omero::model::FormatPtr&) query->findByQuery("from Format as f where f.value='video/mpeg'", 0);

 originalFile->setName(rstring(movieFile));
 originalFile->setPath(rstring(fullPath));
 originalFile->setSize(rlong(size));
 originalFile->setSha1(rstring("pending"));
 originalFile->setFormat(f);

 originalFile = (omero::model::OriginalFilePtr&) up->saveAndReturnObject(originalFile);

 rawfilestore->setFileId(originalFile->getId()->getValue());

However my originalFile object seems to be wrong/incorrect, as the call to originalFile->getId()->getValue() is causing a crash.
Is the above calls the minimum I need to create an OriginalFile object?
I'm running in circles at this end :)

Thanks!

J.
 		 	   		  
_________________________________________________________________
http://clk.atdmt.com/UKM/go/197222280/direct/01/
Do you have a story that started on Hotmail? Tell us now


More information about the ome-devel mailing list