About Store Forum Documentation Contact



Post Reply 
EE::File::operator =
Author Message
Babulesnik Offline
Member

Post: #1
EE::File::operator =
Code:
: error C2783: 'void EE::File::operator =(EE::File &)' : could not deduce template argument for 'UNUSED'

Code:
void StructListPlayers::addGameCMD( SockAddr address , File &GameCMD )
  {
      mapPlayers.find(address)->memGameCMD.add(GameCMD);
  }
12-02-2011 08:17 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #2
RE: EE::File::operator =
I understand in the class "file" is not the "operator=". Does anyone know how to solve this problem?
Code:
Memc<EE::File>memGameCMD;
12-04-2011 11:24 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: EE::File::operator =
File does not and will not support operator=
12-04-2011 12:41 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #4
RE: EE::File::operator =
I had to go another way.
Code:
struct StructPlayer
{
....
Memc<Byte[100]>memGameCMD;
}

Code:
void StructListPlayers::addGameCMD( SockAddr address ,C Byte (&data)[100] )
  {
      mapPlayers.find(address)->memGameCMD.add(data);
  }

But getting the error:
PHP Code:
memory\mem continuous.h(45): error C2440'=' cannot convert from 'const Byte [100]' to 'Byte [100]'
memory\mem continuous.h(45) : while compiling class template member function 'void EE::Memc<TYPE>::add(const TYPE (&))' 

Why a mistake? I use a constant :addGameCMD( SockAddr address ,C Byte (&data)[100] )
(This post was last modified: 12-04-2011 06:19 PM by Babulesnik.)
12-04-2011 06:16 PM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #5
RE: EE::File::operator =
Аnyone know is another way to add the "File" in the container?

Or the reason why is a compilation error:
Code:
(45): error C2440: '=' : cannot convert from 'const Byte [100]' to 'Byte [100]'
memorymem continuous.h
I thought instead of a class "File" to add the container array And then
Byte data[100];
f.readmem(data,SIZE(data));
12-05-2011 07:45 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #6
RE: EE::File::operator =
Two ideas:

Code:
Memc<File> memGameCMD;
...
File &f = mapPlayers.find(address)->memGameCMD.New();
f.readmem(..);

Code:
Memc<Byte *> memGameCMD;
12-07-2011 01:54 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #7
RE: EE::File::operator =
(12-07-2011 01:54 AM)Driklyn Wrote:  Two ideas:

Code:
Memc<File> memGameCMD;
...
File &f = mapPlayers.find(address)->memGameCMD.New();
f.readmem(..);

Code:
Memc<Byte *> memGameCMD;

thank you Driklyn,but these two options do not fit.If use the Memc<Byte *> memGameCMD; any element of the container is equal to = NULL


I solved the problem:

add command:
Code:
         case CS_GAME_COMMAND:
             {
                 Byte data[100];
                 connection.data>>data;
                 // добавляем новую команду в очередь
                 ListPlayers.addGameCMD(connection.address(),data);
             }break;

class methods:
Code:
.....
struct StructGameCMD
{
    Byte data[100];
};
......
struct StructPlayer
{
    Memc<StructGameCMD>memGameCMD;
.....

  void StructListPlayers::addGameCMD( SockAddr address ,C Byte (&data)[100] )
  {
      FREPA(GameCMD.data)GameCMD.data[i]=data[i];
      mapPlayers.find(address)->memGameCMD.add(GameCMD);
  }

example of reading commands:
Code:
if(ListPlayers.mapPlayers.elms()>0)if(ListPlayers.mapPlayers.lockedData(0).memGameCMD.elms()>0)
   {
       File f;f.readMem(ListPlayers.mapPlayers.lockedData(0).memGameCMD(0).data,SIZE(ListPla​yers.mapPlayers.lockedData(0).memGameCMD(0)));

       Byte byte=f.getByte();
       D.text(0, 0.3f,S+"Count : "+ListPlayers.mapPlayers.lockedData(0).memGameCMD.elms()+ " Byte: "+byte);

   }

The code works fine, the commands are transmitted and read,but I would like to optimize code,and I do not really like copying arrays FREPA(GameCMD.data)GameCMD.data[i]=data[i]; with a large number of players that can significantly reduce the performance

PS thanks Driklyn againgrin
12-07-2011 05:01 PM
Find all posts by this user Quote this message in a reply
Driklyn Offline
Member

Post: #8
RE: EE::File::operator =
(12-07-2011 05:01 PM)Babulesnik Wrote:  
Code:
struct StructGameCMD
{
    Byte data[100];
};
......
struct StructPlayer
{
    Memc<StructGameCMD>memGameCMD;
.....

This was my third idea pfft
(This post was last modified: 12-08-2011 03:09 AM by Driklyn.)
12-08-2011 03:09 AM
Find all posts by this user Quote this message in a reply
Babulesnik Offline
Member

Post: #9
RE: EE::File::operator =
(12-08-2011 03:09 AM)Driklyn Wrote:  
(12-07-2011 05:01 PM)Babulesnik Wrote:  
Code:
struct StructGameCMD
{
    Byte data[100];
};
......
struct StructPlayer
{
    Memc<StructGameCMD>memGameCMD;
.....

This was my third idea pfft

lollollol
12-08-2011 11:44 AM
Find all posts by this user Quote this message in a reply
Post Reply