Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef BLUEVIEWFWD_HPP_
00035 #define BLUEVIEWFWD_HPP_
00036
00037 #include <bvt_sdk.h>
00038
00039 #include <boost/shared_ptr.hpp>
00040
00041 #include <stdexcept>
00042
00043 namespace labust
00044 {
00045 namespace blueview
00046 {
00047 typedef boost::shared_ptr<BVTOpaqueSonar> BVSonarPtr;
00048 typedef boost::shared_ptr<BVTOpaqueColorMapper> BVColorMapperPtr;
00049 typedef boost::shared_ptr<BVTOpaquePing> BVPingPtr;
00050 typedef boost::shared_ptr<BVTOpaqueMagImage> BVMagImagePtr;
00051 typedef boost::shared_ptr<BVTOpaqueColorImage> BVColorImagePtr;
00052 typedef boost::shared_ptr<BVTOpaqueNavData> BVNavDataPtr;
00053
00054 struct BVFactory
00055 {
00056 static inline BVSonarPtr makeBVSonar()
00057 {
00058 return BVSonarPtr(BVTSonar_Create(), std::ptr_fun(&BVTSonar_Destroy));
00059 };
00060
00061 static inline BVNavDataPtr makeBVNavData()
00062 {
00063 return BVNavDataPtr(BVTNavData_Create(), std::ptr_fun(&BVTNavData_Destroy));
00064 };
00065
00066 static inline BVNavDataPtr makeBVNavData(BVTNavData data)
00067 {
00068 return BVNavDataPtr(data, std::ptr_fun(&BVTNavData_Destroy));
00069 };
00070
00071 static inline BVColorMapperPtr makeBVColorMapper(const std::string& colormap)
00072 {
00073 BVColorMapperPtr mapper(BVTColorMapper_Create(), std::ptr_fun(&BVTColorMapper_Destroy));
00074 BVTColorMapper_Load(mapper.get(),colormap.c_str());
00075 return mapper;
00076 };
00077
00078 static inline BVPingPtr getBVPing(BVTHead head, int pingNum)
00079 {
00080 BVTPing ping(0);
00081 if (int error = BVTHead_GetPing(head,pingNum,&ping)) throw std::invalid_argument(BVTError_GetString(error));
00082 return BVPingPtr(ping, std::ptr_fun(&BVTPing_Destroy));
00083 };
00084
00085 static inline BVNavDataPtr getBVNavData(BVPingPtr ping)
00086 {
00087 BVTNavData navData = BVTNavData_Create();
00088 if (int error = BVTPing_GetNavDataCopy(ping.get(),&navData)) throw std::invalid_argument(BVTError_GetString(error));
00089 return BVNavDataPtr(navData,std::ptr_fun(&BVTNavData_Destroy));
00090 };
00091
00092 static inline BVMagImagePtr getBVMagImage(BVPingPtr ping)
00093 {
00094 BVTMagImage magnitude(0);
00095 if (int error = BVTPing_GetImage(ping.get(),&magnitude)) throw std::invalid_argument(BVTError_GetString(error));
00096 return BVMagImagePtr(magnitude, std::ptr_fun(&BVTMagImage_Destroy));
00097 };
00098
00099 static inline BVColorImagePtr getBVColorImage(BVMagImagePtr magnitude, BVColorMapperPtr mapper)
00100 {
00101 BVTColorImage image(0);
00102 if (int error = BVTColorMapper_MapImage(mapper.get(),magnitude.get(),&image)) throw std::invalid_argument(BVTError_GetString(error));
00103 return BVColorImagePtr(image, std::ptr_fun(&BVTColorImage_Destroy));
00104 };
00105 };
00106 }
00107 }
00108
00109
00110 #endif