Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9064181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:11:04+00:00 2026-06-16T16:11:04+00:00

class EventDataValue { public: enum Types { NONE, INT, STRING, DOUBLE, ULONG }; EventDataValue()

  • 0
class EventDataValue {
public:
    enum Types {
        NONE,
        INT,
        STRING,
        DOUBLE,
        ULONG
    };

    EventDataValue() { this->Type = NONE; }
    EventDataValue( const EventDataValue &s ) { 
        this->Type = s.Type;

        if (this->Type == INT) 
            this->i = s.i;
        else if (this->Type == STRING)
            this->s = s.s;
        else if (this->Type == DOUBLE)
            this->d = s.d;
        else if (this->Type == ULONG)
            this->ul = s.ul;
    }

    EventDataValue& operator=( const EventDataValue &s ) { 
        this->Type = s.Type;

        if (this->Type == INT) 
            this->i = s.i;
        else if (this->Type == STRING)
            this->s = s.s;
        else if (this->Type == DOUBLE)
            this->d = s.d;
        else if (this->Type == ULONG)
            this->ul = s.ul;

        return *this; 
    }


    EventDataValue(int value) {
        this->Type = INT;
        this->i = value;
    }

    EventDataValue(CString &value) {
        this->Type = STRING;
        this->s = value;
    }

    EventDataValue(LPCTSTR value) {
        this->Type = STRING;
        this->s = CString(value);
    }

    EventDataValue(double value) {
        this->Type = DOUBLE;
        this->d = value;
    }

    EventDataValue(unsigned long value) {
        this->Type = ULONG;
        this->ul = value;
    }

    ~EventDataValue() { }

    operator int(void) const {
        return this->i;
    }

    operator CString(void) const {
        return this->s;
    }

    operator double(void) const {
        return this->d;
    }

    operator unsigned long(void) const {
        return this->ul;
    }


    Types Type;
    int i;
    CString s;
    double d;
    unsigned long ul;
};

class EventData {
public:
    EventData(CString strEventCode, CString &strSessionId, int nFlowId = 0) {
        this->Add(CString(_T("tp")), strEventCode);
        this->Add(CString(_T("ss")), strSessionId);
        this->Add(CString(_T("ts")), (int)std::time(0));

        if (nFlowId != 0)
            this->Add(CString(_T("fl")), nFlowId);
    }

    template <typename T>
    void Add(CString name, T value) {
        EventDataValue event_value(value);

        if (cMap.Lookup(name, NULL) == TRUE)
            return;

        cMap[name] = value;
    }

    CMap<CString, CString, EventDataValue, EventDataValue> cMap;
};

class Events {
public:
    Events() { }
    ~Events() { }

    void Add(EventData ev) {
        this->aEvents.Add(ev);
    }

    CStringW Serialize() {
        CStringW strOutput;
        INT_PTR i, j;

        if (_tcscmp(API_FORMAT, FORMAT_JSON) == 0) {
            for (i = 0; i != this->aEvents.GetCount(); i++) {
                EventData ev = this->aEvents[i];

                strOutput += L"{";

                j = 0;

                POSITION pos = ev.cMap.GetStartPosition();

                while (pos != NULL) {
                    CString key;
                    EventDataValue value;

                    ev.cMap.GetNextAssoc( pos, key, value );

                    strOutput += StringFormat(_T("\"%s\": "), key.GetString());

                    if (value.Type == EventDataValue::STRING) {
                        CString str = value;
                        strOutput += Enquoute(str);
                    } else if (value.Type == EventDataValue::INT) {
                        int n = value;
                        strOutput += StringFormat(_T("%d"), n);
                    } else if (value.Type == EventDataValue::DOUBLE) {
                        double d = value;
                        strOutput += StringFormat(_T("%d"), static_cast<int>(d));
                    } else if (value.Type == EventDataValue::ULONG) {
                        ULONG ul = value;
                        strOutput += StringFormat(_T("%u"), ul);
                    }

                    if (j++ < ev.cMap.GetCount() - 1)
                        strOutput += _T(",");
                }

                strOutput += _T("}");
            }
        } else {
            for (i = 0; i != this->aEvents.GetCount(); i++) {
                EventData ev = this->aEvents[i];

                strOutput += _T("<Event>");

                j = 0;

                POSITION pos = ev.cMap.GetStartPosition();

                while (pos != NULL) {
                    CString key;
                    EventDataValue value;

                    ev.cMap.GetNextAssoc( pos, key, value );

                    strOutput += StringFormat(_T("<%s>"), key.GetString());

                    if (value.Type == EventDataValue::STRING) {
                        CString str = value;
                        strOutput += str;
                    } else if (value.Type == EventDataValue::INT) {
                        int n = value;
                        strOutput += StringFormat(_T("%d"), n);
                    } else if (value.Type == EventDataValue::DOUBLE) {
                        double d = value;
                        strOutput += StringFormat(_T("%d"), static_cast<int>(d));
                    } else if (value.Type == EventDataValue::ULONG) {
                        ULONG ul = value;
                        strOutput += StringFormat(_T("%u"), ul);
                    }

                    strOutput += StringFormat(_T("</%s>"), key.GetString());
                }

                strOutput += _T("</Event>");
            }

        }

        return strOutput;
    }

    CArray<EventData> aEvents;
};

Can someone please tell me why I am getting the following error when I try to compile this?

1>c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afxtempl.h(1329): error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afx.h(559) : see declaration of 'CObject::CObject'
1>          c:\program files (x86)\microsoft visual studio 11.0\vc\atlmfc\include\afx.h(534) : see declaration of 'CObject'
1>          This diagnostic occurred in the compiler generated function 'CMap<KEY,ARG_KEY,VALUE,ARG_VALUE>::CMap(const CMap<KEY,ARG_KEY,VALUE,ARG_VALUE> &)'
1>          with
1>          [
1>              KEY=CString,
1>              ARG_KEY=CString,
1>              VALUE=EventDataValue,
1>              ARG_VALUE=EventDataValue
1>          ]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:11:05+00:00Added an answer on June 16, 2026 at 4:11 pm
    void Add(EventData ev) {
        this->aEvents.Add(ev);
    }
    

    This must be Add(EventData& ev). Your EventData class has no non-default copy constructor or copy assignment operator and has a member (CMap) that is non-copyable. This makes EventData non-copyable. So you can’t pass it by value because that would have to make a copy, which you can’t do since the class is non-copyable.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

class A { public: A():a(0) {} A(int x):a(x) { cout<<convert<<endl; } A(const A& rhs):a(rhs.a)
class A { public: A(const int n_); A(const A& that_); A& operator=(const A& that_);
class Widget; std::vector< std::shared_ptr<Widget> > container class Criterium { public: bool operator()(const Widget& left,
class Foo { public: Foo() { do_something = &Foo::func_x; } int (Foo::*do_something)(int); // function
Class example: public class SomeType { private int type; // some code... public override
Class is a reference types while Struct is a value type. This means that
class Item { private int address; private String itemString; public Item(String item) { separate(item);
class X { int i; public: X() { i = 0; } void set(int
class Test { public static void main(String[] args) throws Exception { Test t =
class a{ public void foo(int a){ System.out.println(super); } } class b extends a{ public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.