Hi guys ,
i am very new to this language so can you tell me which style below function is showing in C++.

SmeConfigRnc::SmeConfigRnc(uint32_t rncId, uint16_t pc) : m_RncId(rncId), m_Pc(pc)
{   
    //Allocate userId
    m_UserId = SmeConfigMgr::GetInstance()->GetFromFreeUserIdPool();
    printf("Allocated for RNC, User Id=%d\n", m_UserId);
    //Allocate mtpSap
    m_MtpSapId = SmeConfigMgr::GetInstance()->GetFromFreeMtpSapIdPool();
    printf("Allocated for RNC, MTP SAP=%d\n", m_MtpSapId);
}

I'm not sure exactly what you're asking when you say
"can you tell me which style below function is showing in C++"

But I can answer the question in the topic title
"what is going on in this function?"

SmeConfigRnc::SmeConfigRnc(uint32_t rncId, uint16_t pc) : m_RncId(rncId), m_Pc(pc)
{   
    //Allocate userId
    m_UserId = SmeConfigMgr::GetInstance()->GetFromFreeUserIdPool();
    printf("Allocated for RNC, User Id=%d\n", m_UserId);
    //Allocate mtpSap
    m_MtpSapId = SmeConfigMgr::GetInstance()->GetFromFreeMtpSapIdPool();
    printf("Allocated for RNC, MTP SAP=%d\n", m_MtpSapId);
}

This line:

SmeConfigRnc::SmeConfigRnc(uint32_t rncId, uint16_t pc) : m_RncId(rncId), m_Pc(pc)

Is the constructor for a class called SmeConfigRnc.
The two parameters (rncId and pc) look as though they are user defined types (uint32_t and uint16_t) which are probably defined elsewhere using typedef statements.. (Otherwise they could be primitive types specific to the compiler being used to compile the program!)
Either way it looks as if they are a 32 bit unsigned integer and a 16 bit unsigned integer.

In the part of the constructor code which says:

: m_RncId(rncId), m_Pc(pc)

Two member variables ( m_RncId and m_Pc) are assigned the values passed into the constructor (i.e. the values of rncId and pc respectively)

The first line in the constructors body (after the comment):

m_UserId = SmeConfigMgr::GetInstance()->GetFromFreeUserIdPool();

This line is doing quite a lot.
SmeConfigMgr looks like it's probably a singleton (a class which can only have one instance in memory), the GetInstance() function will be a static member function of the SmeConfigMgr class which will return a pointer to the current instance of the SmeConfigMgr class.

Basically this line gets a pointer to the SmeConfigMgr class and then calls the GetFromFreeUserIdPool() method of SmeConfigMgr (which I assume returns some kind of int). m_UserId is then assigned the value returned by the call to SmeConfigMgr::GetFromFreeUserIdPool()

The printf statement (which is poor practice to use in a c++ app, std::cout should really be used!) prints a message to the console and shows the value of m_UserId.

Similarly:

m_MtpSapId = SmeConfigMgr::GetInstance()->GetFromFreeMtpSapIdPool();
    printf("Allocated for RNC, MTP SAP=%d\n", m_MtpSapId);

This time a pointer to the current instance of SmeConfigMgr is obtained using a call to SmeConfigMgr::GetInstance() and then the GetFromFreeMtpSapIdPool() method of SmeConfigMgr is called.
m_MtpSapId is assigned the value returned by the call to GetFromFreeMtpSapIdPool()

Finally a printf is used to print a message and the value of m_MtpSapId to the console.

I hope that is of some help!

Cheers for now,
Jason.

commented: Good post. +6
commented: Very Nice Description +8
commented: Nicely explained +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.