[Rprotobuf-commits] r656 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 30 23:53:11 CET 2013


Author: murray
Date: 2013-12-30 23:53:10 +0100 (Mon, 30 Dec 2013)
New Revision: 656

Modified:
   pkg/src/Rcppsupport.h
Log:
whitespace change only.  make this more consistent with the other
files (manually, I don't like what clang-format did to one of the
macros).



Modified: pkg/src/Rcppsupport.h
===================================================================
--- pkg/src/Rcppsupport.h	2013-12-30 22:40:04 UTC (rev 655)
+++ pkg/src/Rcppsupport.h	2013-12-30 22:53:10 UTC (rev 656)
@@ -22,13 +22,13 @@
 
 #include "rprotobuf.h"
 
-namespace rprotobuf{
+namespace rprotobuf {
 
 /* support for Rcpp::wrap protobuf repeated fields, this essentially uses
    the same macro trick as in protobuf, but reversed */
 
-struct enum_field{} ;
-struct message_field{} ;
+struct enum_field{};
+struct message_field{};
 
 class Int64AsStringRepeatedFieldImporter {
 public:
@@ -36,44 +36,44 @@
     typedef string r_import_type;
     Int64AsStringRepeatedFieldImporter(const GPB::Reflection* ref_ ,
                                        const GPB::Message& message_,
-                                       const GPB::FieldDescriptor* field_):
-            ref(ref_), message(message_), field(field_){}
+                                       const GPB::FieldDescriptor* field_)
+        : ref(ref_), message(message_), field(field_) {}
     inline int size() const {
-        return ref->FieldSize( message, field ) ;
+        return ref->FieldSize(message, field);
     }
     inline string get(int i) const {
         stringstream stream;
-        int64 val = ref->GetRepeatedInt64(message, field, i) ;
+        int64 val = ref->GetRepeatedInt64(message, field, i);
         stream << val;
         return stream.str();
     }
   private:
-    const GPB::Reflection* ref ;
-    const GPB::Message& message ;
-    const GPB::FieldDescriptor* field ;
+    const GPB::Reflection* ref;
+    const GPB::Message& message;
+    const GPB::FieldDescriptor* field;
 };
 
 class UInt64AsStringRepeatedFieldImporter {
 public:
     // Probably want to convert to strings here.
     typedef string r_import_type;
-    UInt64AsStringRepeatedFieldImporter(const GPB::Reflection* ref_ ,
+    UInt64AsStringRepeatedFieldImporter(const GPB::Reflection* ref_,
                                         const GPB::Message& message_,
-                                        const GPB::FieldDescriptor* field_):
-            ref(ref_), message(message_), field(field_){}
+                                        const GPB::FieldDescriptor* field_)
+        : ref(ref_), message(message_), field(field_) {}
     inline int size() const {
-        return ref->FieldSize( message, field ) ;
+        return ref->FieldSize(message, field) ;
     }
     inline string get(int i) const {
         stringstream stream;
-        uint64 val = ref->GetRepeatedUInt64(message, field, i) ;
+        uint64 val = ref->GetRepeatedUInt64(message, field, i);
         stream << val;
         return stream.str();
     }
   private:
-    const GPB::Reflection* ref ;
-    const GPB::Message& message ;
-    const GPB::FieldDescriptor* field ;
+    const GPB::Reflection* ref;
+    const GPB::Message& message;
+    const GPB::FieldDescriptor* field;
 };
 
 // TODO(mstokely): Rcpp doesn't handle uint32 properly as of 2013/12
@@ -84,94 +84,94 @@
     typedef double r_import_type;
     UInt32RepeatedFieldImporter(const GPB::Reflection* ref_ ,
 				const GPB::Message& message_,
-				const GPB::FieldDescriptor* field_):
-            ref(ref_), message(message_), field(field_){}
+				const GPB::FieldDescriptor* field_)
+        : ref(ref_), message(message_), field(field_) {}
     inline int size() const {
-        return ref->FieldSize( message, field ) ;
+        return ref->FieldSize(message, field);
     }
     inline double get(int i) const {
 	return double(ref->GetRepeatedUInt32(message, field, i));
     }
   private:
-    const GPB::Reflection* ref ;
-    const GPB::Message& message ;
-    const GPB::FieldDescriptor* field ;
+    const GPB::Reflection* ref;
+    const GPB::Message& message;
+    const GPB::FieldDescriptor* field;
 };
 
 
 template <typename T> class RepeatedFieldImporter{} ;
 
 #undef GENERATE__FIELD__IMPORTER__DECL
-#define GENERATE__FIELD__IMPORTER__DECL(__TYPE__,__CAMEL__)			\
-template<> class RepeatedFieldImporter<__TYPE__>{ 				\
-public:										\
-	typedef __TYPE__ r_import_type ;					\
-	RepeatedFieldImporter(							\
-		const GPB::Reflection* ref_ ,					\
-		const GPB::Message& message_,					\
-		const GPB::FieldDescriptor* field_):				\
-	 	ref(ref_), message(message_), field(field_){}			\
-	inline int size() const {						\
-		return ref->FieldSize( message, field ) ;			\
-	}									\
-	inline __TYPE__ get(int i) const {					\
-		return ref->GetRepeated##__CAMEL__(message, field, i) ; 	\
-	}									\
-private:									\
-	const GPB::Reflection* ref ;						\
-	const GPB::Message& message ;						\
-	const GPB::FieldDescriptor* field ;					\
-}  ;										\
+#define GENERATE__FIELD__IMPORTER__DECL(__TYPE__, __CAMEL__)     \
+template<> class RepeatedFieldImporter<__TYPE__> {               \
+public:                                                          \
+    typedef __TYPE__ r_import_type;                              \
+    RepeatedFieldImporter(                                       \
+        const GPB::Reflection* ref_,                             \
+        const GPB::Message& message_,                            \
+        const GPB::FieldDescriptor* field_):                     \
+        ref(ref_), message(message_), field(field_) {}           \
+    inline int size() const {                                    \
+        return ref->FieldSize( message, field );                 \
+    }                                                            \
+    inline __TYPE__ get(int i) const {                           \
+        return ref->GetRepeated##__CAMEL__(message, field, i);   \
+    }                                                            \
+private:                                                         \
+    const GPB::Reflection* ref;                                  \
+    const GPB::Message& message;                                 \
+    const GPB::FieldDescriptor* field;                           \
+};
 
-GENERATE__FIELD__IMPORTER__DECL(GPB::int32 ,Int32)
-GENERATE__FIELD__IMPORTER__DECL(GPB::uint32,UInt32)
-GENERATE__FIELD__IMPORTER__DECL(GPB::int64,Int64)
-GENERATE__FIELD__IMPORTER__DECL(GPB::uint64,UInt64)
-GENERATE__FIELD__IMPORTER__DECL(float,Float)
-GENERATE__FIELD__IMPORTER__DECL(double,Double)
-GENERATE__FIELD__IMPORTER__DECL(bool,Bool)
-GENERATE__FIELD__IMPORTER__DECL(std::string,String)
+GENERATE__FIELD__IMPORTER__DECL(GPB::int32, Int32)
+GENERATE__FIELD__IMPORTER__DECL(GPB::uint32, UInt32)
+GENERATE__FIELD__IMPORTER__DECL(GPB::int64, Int64)
+GENERATE__FIELD__IMPORTER__DECL(GPB::uint64, UInt64)
+GENERATE__FIELD__IMPORTER__DECL(float, Float)
+GENERATE__FIELD__IMPORTER__DECL(double, Double)
+GENERATE__FIELD__IMPORTER__DECL(bool, Bool)
+GENERATE__FIELD__IMPORTER__DECL(std::string, String)
 #undef GENERATE__FIELD__IMPORTER__DECL
 
 template<> class RepeatedFieldImporter<enum_field>{
 public:
 	typedef int r_import_type ;
-	RepeatedFieldImporter( 
-	 	const GPB::Reflection* ref_ ,		
-		const GPB::Message& message_,		
-		const GPB::FieldDescriptor* field_):	
-		ref(ref_), message(message_), field(field_){} ;
+	RepeatedFieldImporter(
+	 	const GPB::Reflection* ref_,
+		const GPB::Message& message_,
+		const GPB::FieldDescriptor* field_):
+		ref(ref_), message(message_), field(field_) {};
 	inline int size() const {
-		return ref->FieldSize( message, field ) ;
+		return ref->FieldSize( message, field );
 	}
 	inline int get(int i) const {
-		return ref->GetRepeatedEnum(message, field, i)->number() ;
+		return ref->GetRepeatedEnum(message, field, i)->number();
 	}
 private:
-	const GPB::Reflection* ref ;
-	const GPB::Message& message ;
-	const GPB::FieldDescriptor* field ;	
+	const GPB::Reflection* ref;
+	const GPB::Message& message;
+	const GPB::FieldDescriptor* field;
 } ;
 
 template<> class RepeatedFieldImporter<message_field>{
 public:
 	typedef message_field r_import_type ;
-	RepeatedFieldImporter( 
-	 	const GPB::Reflection* ref_ ,		
-		const GPB::Message& message_,		
-		const GPB::FieldDescriptor* field_):	
-		ref(ref_), message(message_), field(field_){} ;
+	RepeatedFieldImporter(
+	 	const GPB::Reflection* ref_ ,
+		const GPB::Message& message_,
+		const GPB::FieldDescriptor* field_):
+		ref(ref_), message(message_), field(field_) {};
 	inline int size() const {
-		return ref->FieldSize( message, field ) ;
+		return ref->FieldSize( message, field );
 	}
 	inline SEXP wrap(int i) const {
-		return S4_Message( CLONE( &ref->GetRepeatedMessage( message, field, i ) ) ) ;
+		return S4_Message(CLONE(&ref->GetRepeatedMessage(message, field, i)));
 	}
 private:
-	const GPB::Reflection* ref ;
-	const GPB::Message& message ;
-	const GPB::FieldDescriptor* field ;	
-} ;
+	const GPB::Reflection* ref;
+	const GPB::Message& message;
+	const GPB::FieldDescriptor* field;
+};
 
 } // namespace rprotobuf
 



More information about the Rprotobuf-commits mailing list