Commit dff888c3 authored by Andrea Bulgarelli's avatar Andrea Bulgarelli
Browse files

Merge branch 'master' of github.com:ASTRO-BO/PacketLib

parents d96ad954 7e5307d5
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -129,14 +129,6 @@ public:
    /// Pointer to the stream
    byte* stream;

    static dword count_object;

    static dword count_object2;

    static dword count_object_deleted;

    static dword count_object_deleted2;

protected:

    /// Internal use only for memory management
+1 −1
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ class SharedPtr
	SharedPtr() : p(0), c(0) {}
	explicit SharedPtr(T* s) : p(s), c(new unsigned(1)) {}

	SharedPtr(int null) : p(0), c(0) {}
	SharedPtr(void* null) : p(0), c(0) {}

	SharedPtr(const SharedPtr& s) : p(s.p), c(s.c) { if(c) ++*c; }

+1 −51
Original line number Diff line number Diff line
@@ -21,14 +21,6 @@
#include "Utility.h"
using namespace PacketLib;

/// Objects that deallocate memory
dword ByteStream::count_object = 0;
/// Objects that do not deallocate memory
dword ByteStream::count_object2 = 0;
dword ByteStream::count_object_deleted = 0;
dword ByteStream::count_object_deleted2 = 0;


/// Returns a pointer of a field in the list of fields of this part of packet.
/// \remarks mem_allocation = true indicates that the allocated memory must be released by the destroyer.
/// \remarks memory_sharing=false In all methods of constructor or set type accepting byte*, it indicates that the swap is applied. 
@@ -137,15 +129,9 @@ PacketLib::ByteStream::~ByteStream()
{
    if(mem_allocation)
    {
        ByteStream::count_object_deleted++;
        //cout << "ByteStream::~ByteStream() delete[] stream;" << endl;
        delete[] stream;
        stream = 0;
    }
    else
        ;
    // ByteStream::count_object_deleted2++;
    //cout <<  "ByteStream::~ByteStream()" << endl;
}


@@ -382,46 +368,10 @@ void PacketLib::ByteStream::swapWordIfStreamIsBigEndian()
    }
}



void PacketLib::ByteStream::setMemoryAllocated(bool allocated)
{

    if(allocated)
    {
        if(mem_allocation_constructor)
        {
            ByteStream::count_object ++;
        }
        else
        {
            if(mem_allocation == false)
            {
                ByteStream::count_object2 --;
                ByteStream::count_object ++;
            }
        }
        mem_allocation = allocated;
    }
    else
    {
        if(mem_allocation_constructor)
        {
            ByteStream::count_object2 ++;
        }
        else
        {
            if(mem_allocation == true)
            {
                ByteStream::count_object --;
                ByteStream::count_object2 ++;
            }
        }
	mem_allocation = allocated;
}
}



void PacketLib::ByteStream::deleteStreamMemory()
{
+1 −2
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ bool SDFRBlock::loadFields(InputText& fp) throw(PacketException*)
{
    try
    {
        char* line;
        numberOfRBlocks = 1;
        rblockFilename = new char* [numberOfRBlocks];
        numberOfBlockFixed[0] = true;
@@ -56,7 +55,7 @@ bool SDFRBlock::loadFields(InputText& fp) throw(PacketException*)
        block[0].loadFields(fp);
        fp.setpos(0);
        /// It gets the [Identifiers] section
        line = fp.getLine("[Identifiers]"); 
        fp.getLine("[Identifiers]");
        return true;
    }
    catch(PacketExceptionIO* e)