blueviewfwd.hpp
Go to the documentation of this file.
00001 /*********************************************************************
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Copyright (c) 2010, LABUST, UNIZG-FER
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *
00011  *   * Redistributions of source code must retain the above copyright
00012  *     notice, this list of conditions and the following disclaimer.
00013  *   * Redistributions in binary form must reproduce the above
00014  *     copyright notice, this list of conditions and the following
00015  *     disclaimer in the documentation and/or other materials provided
00016  *     with the distribution.
00017  *   * Neither the name of the LABUST nor the names of its
00018  *     contributors may be used to endorse or promote products derived
00019  *     from this software without specific prior written permission.
00020  *
00021  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00022  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00023  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00024  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00025  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00026  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00027  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00028  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00029  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00030  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00031  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00032  *  POSSIBILITY OF SUCH DAMAGE.
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 /* BLUEVIEWFWD_HPP_ */
00110 #endif


bvt_sdk
Author(s): Gyula Nagy
autogenerated on Fri Feb 7 2014 11:37:04