Permalink
Browse files

some minor fixes

- default to static libs if building with MSVC
- fix some warnings
- handle OptimizationAlgorithm::solve() return value
  • Loading branch information...
1 parent fbc5ea2 commit 0ab13319be8bd00c5b5e7b3d1ba8cab233ea91f9 @RainerKuemmerle committed Jan 13, 2012
View
@@ -1,3 +1,3 @@
-build
+build*
lib
bin
View
@@ -45,7 +45,11 @@ ELSEIF(CMAKE_BUILD_TYPE MATCHES MinSizeRel)
ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
# Allow the developer to select if Dynamic or Static libraries are built
-OPTION (BUILD_SHARED_LIBS "Build Shared Libraries (preferred and required for the g2o plugin system)" ON)
+IF(MSVC) # MSVC only works if we link statically
+ OPTION (BUILD_SHARED_LIBS "Build Shared Libraries (preferred and required for the g2o plugin system)" OFF)
+ELSE(MSVC)
+ OPTION (BUILD_SHARED_LIBS "Build Shared Libraries (preferred and required for the g2o plugin system)" ON)
+ENDIF()
SET (G2O_LIB_TYPE STATIC)
IF (BUILD_SHARED_LIBS)
SET (G2O_LIB_TYPE SHARED)
@@ -325,7 +325,7 @@ namespace g2o{
double ts = get_time();
- ok = _algorithm->solve(i, online);
+ ok = _algorithm->solve(i, online) == OptimizationAlgorithm::OK;
bool errorComputed = false;
if (cstat) {
View
@@ -43,6 +43,11 @@ using namespace std;
namespace g2o {
+// forward decl of some operators
+std::istream& operator>>(std::istream& is, std::vector<int>& v);
+std::ostream& operator<<(std::ostream& os, const std::vector<int>& v);
+
+
/** Helper class to sort pair based on first elem */
template<class T1, class T2, class Pred = std::less<T1> >
struct CmpPairFirst {
@@ -434,16 +439,14 @@ std::string CommandArgs::trim(const std::string& s) const
return std::string(s, b, e - b + 1);
}
-std::istream& operator >> (std::istream& is, std::vector<int>& v){
+std::istream& operator>>(std::istream& is, std::vector<int>& v){
string s;
if (! (is >> s) )
return is;
- char* cbase=new char[s.length()];
- char* c=cbase;
- char* caux=cbase;
+ const char* c = s.c_str();
+ char* caux = const_cast<char*>(c);
- strcpy(c, s.c_str());
v.clear();
bool hasNextValue=true;
while(hasNextValue){
@@ -455,11 +458,10 @@ std::istream& operator >> (std::istream& is, std::vector<int>& v){
} else
hasNextValue = false;
}
- delete [] cbase;
return is;
}
-std::ostream& operator << (std::ostream& os, const std::vector<int>& v){
+std::ostream& operator<<(std::ostream& os, const std::vector<int>& v){
if (v.size()){
os << v[0];
}
View
@@ -131,9 +131,6 @@ class CommandArgs
std::string trim(const std::string& s) const;
};
- std::istream& operator>>(std::istream& is, std::vector<int>& v);
- std::ostream& operator<<(std::ostream& os, const std::vector<int>& v);
-
} // end namespace
#endif
@@ -18,12 +18,9 @@ namespace g2o {
ParameterVector pv(1);
pv[0]=params;
resolveCache(cache, (OptimizableGraph::Vertex*)_vertices[0],"CACHE_CAMERA",pv);
- return cache;
+ return cache != 0;
}
-
-
-
bool EdgeSE3PointXYZDepth::read(std::istream& is) {
int pid;
is >> pid;

0 comments on commit 0ab1331

Please sign in to comment.