Giter VIP home page Giter VIP logo

capu's People

Contributors

alexanderirion avatar eserdem avatar fwegener avatar hrabbit2000 avatar jjcarit avatar markusbischof avatar sven-v-beuningen avatar tobiashenkel avatar veithm avatar wagnermi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capu's Issues

additional features for the *capu::String* class

Hey guys, I have some ideas for extending the functionality of capu::String:

  • String tokenizer
    e.g. a method capu::Listcapu::String tokenize(capu::String token) offered by capu::String
  • Number<-> String conversion (atm itoa and atoi must be used afaik)
  • An EndsWith method in StringUtils, since StartsWith is implemented already!!!

[compile-need-help]lots of function has not been declared

i have run command like this:
cmake -DCMAKE_TOOLCHAIN_FILE=/home/build/music/capu-0.23.0/cmake/toolchain/Linux_X86_64.toolchain /home/build/music/capu-0.23.0/
make

got error like this.
[ 5%] Building CXX object Capu/CMakeFiles/Capu.dir/src/util/BinaryOutputStream.cpp.o
In file included from /home/build/music/capu-0.23.0/Capu/include/capu/container/String.h:21:0,
from /home/build/music/capu-0.23.0/Capu/include/capu/util/IOutputStream.h:21,
from /home/build/music/capu-0.23.0/Capu/include/capu/util/BinaryOutputStream.h:20,
from /home/build/music/capu-0.23.0/Capu/src/util/BinaryOutputStream.cpp:17:
/home/build/music/capu-0.23.0/Capu/include/capu/os/StringUtils.h: In static member function ‘static void capu::StringUtils::Strncpy(char_, capu::uint_t, const char_)’:
/home/build/music/capu-0.23.0/Capu/include/capu/os/StringUtils.h:135:15: error: ‘capu::os’ has not been declared
capu::os::arch::StringUtils::Strncpy(dst, dstSize, src);

Add String based on tree implementation

On large strings it can be very expensive to search or insert at an arbitrary position.

A possible implementation would be that the given string is split up at a given seperator (e.g. white space) and for each token is added a node to the tree.

The same should happen for insert/append operations.

Discussions welcome!

Should we disable c++ exception?

Since we don't use exception for error-handling, should we add compiler options to disable it? If it's disabled, the branch coverage rate can be more meaningful and be improved a lot.

File mode READ_EXISTING_BINARY opens file for read and write

The file mode READ_EXISTING_BINARY, opens a file not only for reading, but also for writing, which is misleading.
I'd suggest to unitize the existing file modes and introduce a binary file mode for each exisitng non-binary file mode, which accordingly would then be:

  • READ_ONLY_BINARY,
  • WRITE_NEW_BINARY,
  • READ_WRITE_EXISTING_BINARY,
  • READ_WRITE_OVERWRITE_OLD_BINARY

TcpSocket.ConnectTest fails on Mac

I will try to fix the issue the next week.

Do you have any ideas what might be wrong?

[----------] 4 tests from TcpSocket
[ RUN ] TcpSocket.ConnectTest
{...} capu/modules/capu/test/os/TcpSocketTest.cpp:341: Failure
Value of: socket->connect("www.test", port)
Actual: 0
Expected: capu::CAPU_SOCKET_EADDR
Which is: 10
[ FAILED ] TcpSocket.ConnectTest (88 ms)

Date & Time Support

A cross platform solution for getting date and time information would be great.
This is e.g. useful for writing logs or dumps with timestamps.

I currently use this code for Win & Linux:

#include <time.h> // for date and (wall-clock-)time

time_t nowRaw = time(0);
struct tm* now;
now = localtime(&nowRaw);

Bonus points for getting time string in user-defined format, e.g.

const Timestamp ts = getCurrentDateAndTime();
const String& result = timeToString("dd.mm.yy hh:mm", &ts);
// result is now "13.08.30 08:50"

timeToString could interpret 2nd argument = NULL as "use current time"

const String& now = timeToString("yyyy_mm_dd_hh_mm_ss", NULL);
// result is now "2013_08_30_08_50_05"

Of course, better names would be great, I used this longish names just for illustrating my issue.

I (currently) don''t require it, but next question could be:

  • how about calculating with Timestamps?

Non-virtual Destructors

gcc-flags += -Wnon-virtual-dtor

$ make Capu
[  0%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/os/Linux/DynamicLibrary.cpp.o
[ 25%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/LogLevel.cpp.o
[ 25%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/Logger.cpp.o
In file included from /home/timo/ramses-all/external/capu/Capu/src/util/Logger.cpp:1:0:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/Logger.h:93:11: warning: ‘class capu::Logger’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class Logger
           ^
In file included from /home/timo/ramses-all/external/capu/Capu/src/util/Logger.cpp:2:0:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/ILogAppender.h:27:11: warning: ‘class capu::ILogAppender’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class ILogAppender
           ^
In file included from /home/timo/ramses-all/external/capu/Capu/src/util/Logger.cpp:5:0:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/ConsoleLogAppender.h:30:11: warning: ‘class capu::ConsoleLogAppender’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class ConsoleLogAppender: public ILogAppender
           ^
[ 25%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/BinaryOutputStream.cpp.o
[ 25%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/BinaryInputStream.cpp.o
[ 50%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/AsynchronousLogger.cpp.o
In file included from /home/timo/ramses-all/external/capu/Capu/include/capu/util/AsynchronousLogger.h:20:0,
                 from /home/timo/ramses-all/external/capu/Capu/src/util/AsynchronousLogger.cpp:17:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/Logger.h:93:11: warning: ‘class capu::Logger’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class Logger
           ^
In file included from /home/timo/ramses-all/external/capu/Capu/include/capu/util/AsynchronousLogger.h:23:0,
                 from /home/timo/ramses-all/external/capu/Capu/src/util/AsynchronousLogger.cpp:17:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/ILogAppender.h:27:11: warning: ‘class capu::ILogAppender’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class ILogAppender
           ^
[ 50%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/SocketInputStream.cpp.o
[ 50%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/StringOutputStream.cpp.o
[ 50%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/LogContext.cpp.o
[ 50%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/TcpSocketInputStream.cpp.o
[ 75%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/ConsoleLogAppender.cpp.o
In file included from /home/timo/ramses-all/external/capu/Capu/include/capu/util/ConsoleLogAppender.h:20:0,
                 from /home/timo/ramses-all/external/capu/Capu/src/util/ConsoleLogAppender.cpp:1:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/ILogAppender.h:27:11: warning: ‘class capu::ILogAppender’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class ILogAppender
           ^
In file included from /home/timo/ramses-all/external/capu/Capu/src/util/ConsoleLogAppender.cpp:1:0:
/home/timo/ramses-all/external/capu/Capu/include/capu/util/ConsoleLogAppender.h:30:11: warning: ‘class capu::ConsoleLogAppender’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor]
     class ConsoleLogAppender: public ILogAppender
           ^
[ 75%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/BinaryFileInputStream.cpp.o
[ 75%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/ThreadPool.cpp.o
[ 75%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/BinaryFileOutputStream.cpp.o
[100%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/util/LogMessage.cpp.o
[100%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/os/Generic/Math.cpp.o
[100%] Building CXX object external/capu/Capu/CMakeFiles/Capu.dir/src/os/Posix/Console.cpp.o
Linking CXX static library libCapu.a
[100%] Built target Capu

Selective export of header files

When creating the deliverable for a platform abstraction only header files required for this abstraction should be included. For example the deliverable for iPhoneOS_ARM64 should only include headers for Generic / Posix / iPhoneOS and iPhoneOS/ARM64. Header files for Android / Linux / Windows / etc. should not be included.

stdint.h is not available in Visual Studio 2010

Hi,

I've seen that the Config.h file has changed. Now it uses the stdint.h file to define the capu types. It seems that this file is not available with Visual Studio 2010. Can we switch back to the old version of Config.h?

Sven

Rename macros used for OS abstraction

On Windows, the macro OS_WINDOWS is already used in shlwapi.h. Depending on your project configuration, multiple defines may treated as an error.
E.g.
9>C:\Program Files (x86)\Windows Kits\8.0\Include\um\shlwapi.h(2023): error C2220: warning treated as error - no 'object' file generated
9>C:\Program Files (x86)\Windows Kits\8.0\Include\um\shlwapi.h(2023): warning C4005: 'OS_WINDOWS' : macro redefinition
9> command-line arguments : see previous definition of 'OS_WINDOWS'

We should add a prefix to our CAPU macros, and then remove the Hack in Windows/File.h

Alignment Exception

When running the tests on a board with ARMv7, the tests fail with an Alignment Exception.
The test suite fails at BinaryOutputStreamTest.InsertMultipleData. My investigation showed that this exception depends on the order in which data is put into the stream. The problem shows if you insert a bool before float.

The serial of the board prints:

Alignment trap: not handling instruction ed977a00 at [<00275fec>]
Unhandled fault: alignment exception (0x011) at 0x003c42d5

Processor Information:

model name : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 12.30
Features : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x2
CPU part : 0xc0f
CPU revision : 2

Add StringStream implementation

By using the existing interfaces (IInputStream, IOutputStream) a StringStream implementation would be nice to have.
A StringStream should double its internal memory as soon as it is getting full (see BinaryInputStream).

A StringStream should accept basic datatypes, user specific datatypes can be added to a stream by the user by overloading respective operators.

HashTable "Key-Values" - no const smartpointer_cast

This Issue is depended to the Apache Etch Library but i will use general syntax.

If you got a HashTable with general SmartPointers (in further usage SP) then it is not possible to cast the Key-Value of the HashTableEntry to an readable object without using some "hacks".

e.g.: (Object = base class of any other class in used framework)

capu::SP<capu::HashTable<SP<Object> , SP<Object> > hTable = new capu::HashTable<SP<Object> , SP<Object> > (5); 

hTable->put(new IntObject(12), new StringObject("hello");
hTable->put(new IntObject(13), new StringObject("world");


capu::HashTable<SP<Object> , SP<Object>::Iterator i;

for(i = hTable->begin(); i != hTable->end(); i++)
{
   //checks if Key object is type of IntObject etc.
   SP<IntObject> iO = capu::smartpointer_cast<IntObject>(i->key); //Not Possible because the Key is const
}

capu::File::getParentFile(...) sets platform specific separator.

When getting a parent file with the following LOCs

capu::File file("C:/foo/bar");
capu::File parentFile = file.getParentFile(bool_ok);

the resulting capu::String of parentFile.getPath() says -> "C:\foo"
which can't be the expected platform independent form to specifiy a filename, is it?

I only tested this case on a windows machine, so I can't tell how this issue behaves on other OS.

Capu build fails when using cmake option "CONFIG_BUILD_UNITTESTS=0"

Build fails with the following statement (ACME error):

 CMake Error at C:/work/code/Capu/cmake/acme/internal/doit.cmake:450 (LIST):
2>    list sub-command REMOVE_DUPLICATES requires list to be present.
2>  Call Stack (most recent call first):
2>    C:/work/code/Capu/cmake/acme/internal/doit.cmake:57 (INTERNAL_DOIT_REMOVE_DUPLICATES)
2>    C:/work/code/Capu/cmake/acme/internal/functions.cmake:53 (INTERNAL_JUST_DOIT)
2>    C:/work/code/Capu/cmake/acme/acme.cmake:130 (INTERNAL_ACME_ADD_SUBDIRECTORY)
2>    modules/CMakeLists.txt:19 (ACME_ADD_SUBDIRECTORY)
2>  
2>  
2>  CMake Error at C:/work/code/Capu/cmake/acme/internal/doit.cmake:450 (LIST):
2>    list sub-command REMOVE_DUPLICATES requires list to be present.
2>  Call Stack (most recent call first):
2>    C:/work/code/Capu/cmake/acme/internal/doit.cmake:57 (INTERNAL_DOIT_REMOVE_DUPLICATES)
2>    C:/work/code/Capu/cmake/acme/internal/functions.cmake:53 (INTERNAL_JUST_DOIT)
2>    C:/work/code/Capu/cmake/acme/acme.cmake:130 (INTERNAL_ACME_ADD_SUBDIRECTORY)
2>    CMakeLists.txt:24 (ACME_ADD_SUBDIRECTORY)

Expand Documentation

At the moment the only documentation we have is our Readme.txt file.

We should expand the documentation, my proposal is to do it with doxygen in order to have both the API documentation and the rest of the documentation in on location.
There is already a docs folder in the repository which contains a skeleton.

The documentation should contain at least a "How to build" section.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.