Skip to content
Browse files

First API draft

  • Loading branch information...
1 parent da231d5 commit 81b1a5402988aea7a265615878dba033b339d5db @eile eile committed Apr 20, 2012
Showing with 247 additions and 6 deletions.
  1. +6 −6 GLStats/api.h
  2. +37 −0 GLStats/data.h
  3. +35 −0 GLStats/entity.h
  4. +6 −0 GLStats/files.cmake
  5. +40 −0 GLStats/item.h
  6. +56 −0 GLStats/renderer.h
  7. +35 −0 GLStats/thread.h
  8. +32 −0 GLStats/types.h
View
12 GLStats/api.h
@@ -20,19 +20,19 @@
#define GLSTATS_API_H
#if defined(_MSC_VER) || defined(__declspec)
-# define LB_DLLEXPORT __declspec(dllexport)
-# define LB_DLLIMPORT __declspec(dllimport)
+# define GLSTATS_DLLEXPORT __declspec(dllexport)
+# define GLSTATS_DLLIMPORT __declspec(dllimport)
#else // _MSC_VER
-# define LB_DLLEXPORT
-# define LB_DLLIMPORT
+# define GLSTATS_DLLEXPORT
+# define GLSTATS_DLLIMPORT
#endif // _MSC_VER
#if defined(GLSTATS_STATIC)
# define GLSTATS_API
#elif defined(GLSTATS_SHARED)
-# define GLSTATS_API LB_DLLEXPORT
+# define GLSTATS_API GLSTATS_DLLEXPORT
#else
-# define GLSTATS_API LB_DLLIMPORT
+# define GLSTATS_API GLSTATS_DLLIMPORT
#endif
#endif //GLSTATS_API_H
View
37 GLStats/data.h
@@ -0,0 +1,37 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GLSTATS_DATA_H
+#define GLSTATS_DATA_H
+
+#include <GLStats/api.h>
+
+namespace GLStats
+{
+ /** The data storage. */
+ class Data
+ {
+ public:
+ /** Construct a new data storage. */
+ GLSTATS_API Data();
+ GLSTATS_API void addEntity( const Entity& entity );
+ GLSTATS_API void addThread( const Thread& thread );
+ GLSTATS_API void addItem( const Item& item );
+ };
+}
+
+#endif //GLSTATS_DATA_H
View
35 GLStats/entity.h
@@ -0,0 +1,35 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GLSTATS_ENTITY_H
+#define GLSTATS_ENTITY_H
+
+#include <GLStats/api.h>
+
+namespace GLStats
+{
+ /** One statistics entity. */
+ struct Entity
+ {
+ Entity() : identifier( 0 ) {}
+
+ uint32_t identifier; //!< Entity identifier used in item
+ std::string name; //!< Name printed in statistics
+ };
+}
+
+#endif //GLSTATS_ENTITY_H
View
6 GLStats/files.cmake
@@ -8,6 +8,12 @@ update_file(${CMAKE_CURRENT_SOURCE_DIR}/version.in.h
set(GLSTATS_PUBLIC_HEADERS
${OUTPUT_INCLUDE_DIR}/GLStats/version.h
api.h
+ data.h
+ entity.h
+ item.h
+ renderer.h
+ thread.h
+ types.h
)
set(GLSTATS_SOURCES
View
40 GLStats/item.h
@@ -0,0 +1,40 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GLSTATS_ITEM_H
+#define GLSTATS_ITEM_H
+
+#include <GLStats/api.h>
+
+namespace GLStats
+{
+ /** One statistics item. */
+ struct Item
+ {
+ Item() : start( -1 ), end( -1 ), order( 0 ), entity( 0 ), thread( 0 )
+ , frame( 0 ) {}
+
+ int64_t start; //!< Beginning of the event
+ int64_t end; //!< End of the event
+ uint32_t order; //!< Depth of a (sub-)event
+ uint32_t entity; //!< Identifier of the reporting entity
+ uint32_t thread; //!< Identifier of the reporting thread
+ uint32_t frame; //!< The rendering frame number
+ };
+}
+
+#endif //GLSTATS_ITEM_H
View
56 GLStats/renderer.h
@@ -0,0 +1,56 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GLSTATS_RENDERER_H
+#define GLSTATS_RENDERER_H
+
+#include <GLStats/api.h>
+
+namespace GLStats
+{
+namespace detail { class GLStats; }
+
+ /** The default renderer. */
+ class Renderer
+ {
+ public:
+ /** Construct a new renderer. */
+ GLSTATS_API Renderer();
+
+ /** Destruct this renderer. */
+ GLSTATS_API virtual ~Renderer();
+
+ /** Set the size of the rendering area in pixels. */
+ GLSTATS_API void setViewportSize( const uint32_t size[2] );
+
+ /** Remove unneeded items from the data set. */
+ GLSTATS_API void obsolete( Data& data );
+
+ /**
+ * Render the data set.
+ *
+ * The OpenGL state has to be set up to ...
+ * @param data the statistics data
+ */
+ GLSTATS_API void draw( Data& data );
+
+ private:
+ detail::GLStats* const _impl;
+ };
+}
+
+#endif //GLSTATS_RENDERER_H
View
35 GLStats/thread.h
@@ -0,0 +1,35 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef GLSTATS_THREAD_H
+#define GLSTATS_THREAD_H
+
+#include <GLStats/api.h>
+
+namespace GLStats
+{
+ /** One statistics thread. */
+ struct Thread
+ {
+ Thread() : identifier( 0 ) {}
+
+ uint32_t identifier; //!< Thread identifier used in item
+ std::string name; //!< Name printed in statistics
+ };
+}
+
+#endif //GLSTATS_THREAD_H
View
32 GLStats/types.h
@@ -0,0 +1,32 @@
+
+/* Copyright (c) 2012, Stefan Eilemann <eile@eyescale.ch>
+ *
+ * This library is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License version 2.1 as published
+ * by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/** Basic type definitions not provided by the operating system. */
+
+#ifndef GLSTATS_TYPES_H
+#define GLSTATS_TYPES_H
+
+namespace GLStats
+{
+class Data;
+class Renderer;
+struct Entity;
+struct Item;
+struct Thread;
+}
+
+#endif //GLSTATS_TYPES_H

0 comments on commit 81b1a54

Please sign in to comment.
Something went wrong with that request. Please try again.