1
1

Change from old-C-style casting to get rid of const to proper

const_cast<>-style casting.  For the rationle behind this, see:

http://www.open-mpi.org/community/lists/users/2005/11/0391.php

This commit was SVN r8327.
Этот коммит содержится в:
Jeff Squyres 2005-11-30 03:22:27 +00:00
родитель d55893349f
Коммит 6149b5fec8
11 изменённых файлов: 125 добавлений и 119 удалений

Просмотреть файл

@ -25,7 +25,7 @@ inline void
MPI::Comm::Send(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
(void)MPI_Send((void *)buf, count, datatype, dest, tag, mpi_comm);
(void)MPI_Send(const_cast<void *>(buf), count, datatype, dest, tag, mpi_comm);
}
inline void
@ -47,7 +47,7 @@ inline void
MPI::Comm::Bsend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
(void)MPI_Bsend((void *)buf, count, datatype,
(void)MPI_Bsend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm);
}
@ -55,7 +55,7 @@ inline void
MPI::Comm::Ssend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
(void)MPI_Ssend((void *)buf, count, datatype, dest,
(void)MPI_Ssend(const_cast<void *>(buf), count, datatype, dest,
tag, mpi_comm);
}
@ -63,7 +63,7 @@ inline void
MPI::Comm::Rsend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
(void)MPI_Rsend((void *)buf, count, datatype,
(void)MPI_Rsend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm);
}
@ -72,7 +72,7 @@ MPI::Comm::Isend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Isend((void *)buf, count, datatype,
(void)MPI_Isend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -82,7 +82,7 @@ MPI::Comm::Ibsend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Ibsend((void *)buf, count, datatype,
(void)MPI_Ibsend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -92,7 +92,7 @@ MPI::Comm::Issend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Issend((void *)buf, count, datatype,
(void)MPI_Issend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -102,7 +102,7 @@ MPI::Comm::Irsend(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Irsend((void *) buf, count, datatype,
(void)MPI_Irsend(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -151,7 +151,7 @@ MPI::Comm::Send_init(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Send_init((void *)buf, count, datatype,
(void)MPI_Send_init(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -161,7 +161,7 @@ MPI::Comm::Bsend_init(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Bsend_init((void *)buf, count, datatype,
(void)MPI_Bsend_init(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -171,7 +171,7 @@ MPI::Comm::Ssend_init(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Ssend_init((void *)buf, count, datatype,
(void)MPI_Ssend_init(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -181,7 +181,7 @@ MPI::Comm::Rsend_init(const void *buf, int count,
const MPI::Datatype & datatype, int dest, int tag) const
{
MPI_Request request;
(void)MPI_Rsend_init((void *)buf, count, datatype,
(void)MPI_Rsend_init(const_cast<void *>(buf), count, datatype,
dest, tag, mpi_comm, &request);
return request;
}
@ -203,7 +203,7 @@ MPI::Comm::Sendrecv(const void *sendbuf, int sendcount,
const MPI::Datatype & recvtype, int source,
int recvtag, MPI::Status & status) const
{
(void)MPI_Sendrecv((void *)sendbuf, sendcount,
(void)MPI_Sendrecv(const_cast<void *>(sendbuf), sendcount,
sendtype,
dest, sendtag, recvbuf, recvcount,
recvtype,
@ -217,7 +217,7 @@ MPI::Comm::Sendrecv(const void *sendbuf, int sendcount,
const MPI::Datatype & recvtype, int source,
int recvtag) const
{
(void)MPI_Sendrecv((void *)sendbuf, sendcount,
(void)MPI_Sendrecv(const_cast<void *>(sendbuf), sendcount,
sendtype,
dest, sendtag, recvbuf, recvcount,
recvtype,
@ -334,7 +334,7 @@ MPI::Comm::Get_name(char* comm_name, int& resultlen) const
inline void
MPI::Comm::Set_name(const char* comm_name)
{
(void) MPI_Comm_set_name(mpi_comm, (char *)comm_name);
(void) MPI_Comm_set_name(mpi_comm, const_cast<char *>(comm_name));
}
//

Просмотреть файл

@ -45,8 +45,8 @@ MPI::Datatype::Create_indexed(int count,
const int array_of_displacements[]) const
{
MPI_Datatype newtype;
(void)MPI_Type_indexed(count, (int *) array_of_blocklengths,
(int *) array_of_displacements, mpi_datatype, &newtype);
(void)MPI_Type_indexed(count, const_cast<int *>(array_of_blocklengths),
const_cast<int *>(array_of_displacements), mpi_datatype, &newtype);
return newtype;
}
@ -61,8 +61,8 @@ MPI::Datatype::Create_struct(int count, const int array_of_blocklengths[],
for (i=0; i < count; i++)
type_array[i] = array_of_types[i];
(void)MPI_Type_create_struct(count, (int*)array_of_blocklengths,
(MPI_Aint*)array_of_displacements,
(void)MPI_Type_create_struct(count, const_cast<int *>(array_of_blocklengths),
const_cast<MPI_Aint*>(array_of_displacements),
type_array, &newtype);
delete[] type_array;
return newtype;
@ -73,8 +73,8 @@ MPI::Datatype::Create_hindexed(int count, const int array_of_blocklengths[],
const MPI::Aint array_of_displacements[]) const
{
MPI_Datatype newtype;
(void)MPI_Type_create_hindexed(count, (int*)array_of_blocklengths,
(MPI_Aint*)array_of_displacements,
(void)MPI_Type_create_hindexed(count, const_cast<int *>(array_of_blocklengths),
const_cast<MPI_Aint*>(array_of_displacements),
mpi_datatype, &newtype) ;
return newtype;
}
@ -121,7 +121,7 @@ MPI::Datatype::Pack(const void* inbuf, int incount,
void *outbuf, int outsize,
int& position, const MPI::Comm &comm) const
{
(void)MPI_Pack((void *) inbuf, incount, mpi_datatype, outbuf,
(void)MPI_Pack(const_cast<void *>(inbuf), incount, mpi_datatype, outbuf,
outsize, &position, comm);
}
@ -130,7 +130,7 @@ MPI::Datatype::Unpack(const void* inbuf, int insize,
void *outbuf, int outcount, int& position,
const MPI::Comm& comm) const
{
(void)MPI_Unpack((void *) inbuf, insize, &position,
(void)MPI_Unpack(const_cast<void *>(inbuf), insize, &position,
outbuf, outcount, mpi_datatype, comm);
}
@ -154,8 +154,9 @@ MPI::Datatype::Create_subarray(int ndims, const int array_of_sizes[],
const
{
MPI_Datatype type;
(void) MPI_Type_create_subarray(ndims, (int *) array_of_sizes,
(int *) array_of_subsizes, (int *) array_of_starts,
(void) MPI_Type_create_subarray(ndims, const_cast<int *>(array_of_sizes),
const_cast<int *>(array_of_subsizes),
const_cast<int *>(array_of_starts),
order, mpi_datatype, &type);
return type;
}
@ -222,9 +223,9 @@ MPI::Datatype::Get_contents(int max_integers, int max_addresses,
const
{
(void) MPI_Type_get_contents(mpi_datatype, max_integers, max_addresses,
max_datatypes, (int *)array_of_integers,
(MPI_Aint*) array_of_addresses,
(MPI_Datatype *) array_of_datatypes);
max_datatypes, const_cast<int *>(array_of_integers),
const_cast<MPI_Aint*>(array_of_addresses),
(MPI_Datatype *)(array_of_datatypes));
}
inline void
@ -245,14 +246,14 @@ MPI::Datatype::Get_name(char* type_name, int& resultlen) const
inline void
MPI::Datatype::Set_attr(int type_keyval, const void* attribute_val)
{
(void) MPI_Type_set_attr(mpi_datatype, type_keyval, (void *) attribute_val);
(void) MPI_Type_set_attr(mpi_datatype, type_keyval, const_cast<void *>(attribute_val));
}
inline void
MPI::Datatype::Set_name(const char* type_name)
{
(void) MPI_Type_set_name(mpi_datatype, (char *)type_name);
(void) MPI_Type_set_name(mpi_datatype, const_cast<char *>(type_name));
}

Просмотреть файл

@ -27,7 +27,7 @@ MPI::File::Close()
inline void
MPI::File::Delete(const char* filename, const MPI::Info& info)
{
(void) MPI_File_delete((char*)filename, info);
(void) MPI_File_delete(const_cast<char *>(filename), info);
}
@ -163,7 +163,7 @@ MPI::File::Iwrite(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Request req;
(void) MPI_File_iwrite(mpi_file, (void*) buf, count, datatype, &req);
(void) MPI_File_iwrite(mpi_file, const_cast<void *>(buf), count, datatype, &req);
return req;
}
@ -173,7 +173,7 @@ MPI::File::Iwrite_at(MPI::Offset offset, const void* buf,
int count, const MPI::Datatype& datatype)
{
MPI_Request req;
(void) MPI_File_iwrite_at(mpi_file, offset, (void*) buf, count, datatype,
(void) MPI_File_iwrite_at(mpi_file, offset, const_cast<void *>(buf), count, datatype,
&req);
return req;
}
@ -184,7 +184,7 @@ MPI::File::Iwrite_shared(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Request req;
(void) MPI_File_iwrite_shared(mpi_file, (void*) buf, count, datatype, &req);
(void) MPI_File_iwrite_shared(mpi_file, const_cast<void *>(buf), count, datatype, &req);
return req;
}
@ -195,7 +195,7 @@ MPI::File::Open(const MPI::Intracomm& comm,
const MPI::Info& info)
{
MPI_File fh;
(void) MPI_File_open(comm, (char*) filename, amode, info, &fh);
(void) MPI_File_open(comm, const_cast<char *>(filename), amode, info, &fh);
return fh;
}
@ -432,7 +432,7 @@ MPI::File::Set_view(MPI::Offset disp,
const char* datarep,
const MPI::Info& info)
{
(void) MPI_File_set_view(mpi_file, disp, etype, filetype, (char*) datarep,
(void) MPI_File_set_view(mpi_file, disp, etype, filetype, const_cast<char *>(datarep),
info);
}
@ -449,7 +449,7 @@ MPI::File::Write(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write(mpi_file, (void*) buf, count, datatype, &status);
(void) MPI_File_write(mpi_file, const_cast<void *>(buf), count, datatype, &status);
}
@ -458,7 +458,7 @@ MPI::File::Write(const void* buf, int count,
const MPI::Datatype& datatype,
MPI::Status& status)
{
(void) MPI_File_write(mpi_file, (void*) buf, count, datatype,
(void) MPI_File_write(mpi_file, const_cast<void *>(buf), count, datatype,
&status.mpi_status);
}
@ -468,7 +468,7 @@ MPI::File::Write_all(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write_all(mpi_file, (void*) buf, count, datatype, &status);
(void) MPI_File_write_all(mpi_file, const_cast<void *>(buf), count, datatype, &status);
}
@ -478,7 +478,7 @@ MPI::File::Write_all(const void* buf, int count,
const MPI::Datatype& datatype,
MPI::Status& status)
{
(void) MPI_File_write_all(mpi_file, (void*) buf, count, datatype,
(void) MPI_File_write_all(mpi_file, const_cast<void *>(buf), count, datatype,
&status.mpi_status);
}
@ -487,7 +487,7 @@ inline void
MPI::File::Write_all_begin(const void* buf, int count,
const MPI::Datatype& datatype)
{
(void) MPI_File_write_all_begin(mpi_file, (void*) buf, count, datatype);
(void) MPI_File_write_all_begin(mpi_file, const_cast<void *>(buf), count, datatype);
}
@ -495,14 +495,14 @@ inline void
MPI::File::Write_all_end(const void* buf)
{
MPI_Status status;
(void) MPI_File_write_all_end(mpi_file, (void*) buf, &status);
(void) MPI_File_write_all_end(mpi_file, const_cast<void *>(buf), &status);
}
inline void
MPI::File::Write_all_end(const void* buf, MPI::Status& status)
{
(void) MPI_File_write_all_end(mpi_file, (void*) buf, &status.mpi_status);
(void) MPI_File_write_all_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
}
@ -512,7 +512,7 @@ MPI::File::Write_at(MPI::Offset offset,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write_at(mpi_file, offset, (void*) buf, count,
(void) MPI_File_write_at(mpi_file, offset, const_cast<void *>(buf), count,
datatype, &status);
}
@ -523,7 +523,7 @@ MPI::File::Write_at(MPI::Offset offset,
const MPI::Datatype& datatype,
MPI::Status& status)
{
(void) MPI_File_write_at(mpi_file, offset, (void*) buf, count,
(void) MPI_File_write_at(mpi_file, offset, const_cast<void *>(buf), count,
datatype, &status.mpi_status);
}
@ -534,7 +534,7 @@ MPI::File::Write_at_all(MPI::Offset offset,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write_at_all(mpi_file, offset, (void*) buf, count,
(void) MPI_File_write_at_all(mpi_file, offset, const_cast<void *>(buf), count,
datatype, &status);
}
@ -545,7 +545,7 @@ MPI::File::Write_at_all(MPI::Offset offset,
const MPI::Datatype& datatype,
MPI::Status& status)
{
(void) MPI_File_write_at_all(mpi_file, offset, (void*) buf, count,
(void) MPI_File_write_at_all(mpi_file, offset, const_cast<void *>(buf), count,
datatype, &status.mpi_status);
}
@ -555,7 +555,7 @@ MPI::File::Write_at_all_begin(MPI::Offset offset,
const void* buf, int count,
const MPI::Datatype& datatype)
{
(void) MPI_File_write_at_all_begin(mpi_file, offset, (void*) buf, count,
(void) MPI_File_write_at_all_begin(mpi_file, offset, const_cast<void *>(buf), count,
datatype);
}
@ -564,14 +564,14 @@ inline void
MPI::File::Write_at_all_end(const void* buf)
{
MPI_Status status;
(void) MPI_File_write_at_all_end(mpi_file, (void*) buf, &status);
(void) MPI_File_write_at_all_end(mpi_file, const_cast<void *>(buf), &status);
}
inline void
MPI::File::Write_at_all_end(const void* buf, MPI::Status& status)
{
(void) MPI_File_write_at_all_end(mpi_file, (void*) buf, &status.mpi_status);
(void) MPI_File_write_at_all_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
}
@ -580,7 +580,7 @@ MPI::File::Write_ordered(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write_ordered(mpi_file, (void*) buf, count, datatype,
(void) MPI_File_write_ordered(mpi_file, const_cast<void *>(buf), count, datatype,
&status);
}
@ -590,7 +590,7 @@ MPI::File::Write_ordered(const void* buf, int count,
const MPI::Datatype& datatype,
MPI::Status& status)
{
(void) MPI_File_write_ordered(mpi_file, (void*) buf, count, datatype,
(void) MPI_File_write_ordered(mpi_file, const_cast<void *>(buf), count, datatype,
&status.mpi_status);
}
@ -599,7 +599,7 @@ inline void
MPI::File::Write_ordered_begin(const void* buf, int count,
const MPI::Datatype& datatype)
{
(void) MPI_File_write_ordered_begin(mpi_file, (void*) buf, count, datatype);
(void) MPI_File_write_ordered_begin(mpi_file, const_cast<void *>(buf), count, datatype);
}
@ -607,7 +607,7 @@ inline void
MPI::File::Write_ordered_end(const void* buf)
{
MPI_Status status;
(void) MPI_File_write_ordered_end(mpi_file, (void*) buf, &status);
(void) MPI_File_write_ordered_end(mpi_file, const_cast<void *>(buf), &status);
}
@ -615,7 +615,7 @@ inline void
MPI::File::Write_ordered_end(const void* buf,
MPI::Status& status)
{
(void) MPI_File_write_ordered_end(mpi_file, (void*) buf, &status.mpi_status);
(void) MPI_File_write_ordered_end(mpi_file, const_cast<void *>(buf), &status.mpi_status);
}
@ -624,7 +624,7 @@ MPI::File::Write_shared(const void* buf, int count,
const MPI::Datatype& datatype)
{
MPI_Status status;
(void) MPI_File_write_shared(mpi_file, (void*) buf, count,
(void) MPI_File_write_shared(mpi_file, const_cast<void *>(buf), count,
datatype, &status);
}
@ -633,7 +633,7 @@ inline void
MPI::File::Write_shared(const void* buf, int count,
const MPI::Datatype& datatype, MPI::Status& status)
{
(void) MPI_File_write_shared(mpi_file, (void*) buf, count,
(void) MPI_File_write_shared(mpi_file, const_cast<void *>(buf), count,
datatype, &status.mpi_status);
}

Просмотреть файл

@ -196,7 +196,7 @@ MPI::Free_mem(void* base)
inline void
MPI::Close_port(const char* port_name)
{
(void) MPI_Close_port((char *) port_name);
(void) MPI_Close_port(const_cast<char *>(port_name));
}
@ -205,7 +205,7 @@ MPI::Lookup_name(const char * service_name,
const MPI::Info& info,
char* port_name)
{
(void) MPI_Lookup_name((char *) service_name, info, port_name);
(void) MPI_Lookup_name(const_cast<char *>(service_name), info, port_name);
}
@ -221,8 +221,8 @@ MPI::Publish_name(const char* service_name,
const MPI::Info& info,
const char* port_name)
{
(void) MPI_Publish_name((char *) service_name, info,
(char *) port_name);
(void) MPI_Publish_name(const_cast<char *>(service_name), info,
const_cast<char *>(port_name));
}
@ -231,8 +231,8 @@ MPI::Unpublish_name(const char* service_name,
const MPI::Info& info,
const char* port_name)
{
(void)MPI_Unpublish_name((char *) service_name, info,
(char *) port_name);
(void)MPI_Unpublish_name(const_cast<char *>(service_name), info,
const_cast<char *>(port_name));
}

Просмотреть файл

@ -42,7 +42,7 @@ MPI::Group::Translate_ranks (const MPI::Group& group1, int n,
const int ranks1[],
const MPI::Group& group2, int ranks2[])
{
(void)MPI_Group_translate_ranks(group1, n, (int*)ranks1, group2, (int*)ranks2);
(void)MPI_Group_translate_ranks(group1, n, const_cast<int *>(ranks1), group2, const_cast<int *>(ranks2));
}
inline int
@ -81,7 +81,7 @@ inline MPI::Group
MPI::Group::Incl(int n, const int ranks[]) const
{
MPI_Group newgroup;
(void)MPI_Group_incl(mpi_group, n, (int*)ranks, &newgroup);
(void)MPI_Group_incl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
return newgroup;
}
@ -89,7 +89,7 @@ inline MPI::Group
MPI::Group::Excl(int n, const int ranks[]) const
{
MPI_Group newgroup;
(void)MPI_Group_excl(mpi_group, n, (int*)ranks, &newgroup);
(void)MPI_Group_excl(mpi_group, n, const_cast<int *>(ranks), &newgroup);
return newgroup;
}
@ -97,7 +97,7 @@ inline MPI::Group
MPI::Group::Range_incl(int n, const int ranges[][3]) const
{
MPI_Group newgroup;
(void)MPI_Group_range_incl(mpi_group, n, (int(*)[3])ranges, &newgroup);
(void)MPI_Group_range_incl(mpi_group, n, const_cast<int(*)[3]>(ranges), &newgroup);
return newgroup;
}
@ -105,7 +105,7 @@ inline MPI::Group
MPI::Group::Range_excl(int n, const int ranges[][3]) const
{
MPI_Group newgroup;
(void)MPI_Group_range_excl(mpi_group, n, (int(*)[3])ranges, &newgroup);
(void)MPI_Group_range_excl(mpi_group, n, const_cast<int(*)[3]>(ranges), &newgroup);
return newgroup;
}

Просмотреть файл

@ -29,7 +29,7 @@ MPI::Info::Create()
inline void
MPI::Info::Delete(const char* key)
{
(void)MPI_Info_delete(mpi_info, (char*)key);
(void)MPI_Info_delete(mpi_info, const_cast<char *>(key));
}
inline MPI::Info
@ -50,7 +50,7 @@ inline bool
MPI::Info::Get(const char* key, int valuelen, char* value) const
{
int flag;
(void)MPI_Info_get(mpi_info, (char*)key, valuelen, value, &flag);
(void)MPI_Info_get(mpi_info, const_cast<char *>(key), valuelen, value, &flag);
return (bool) flag;
}
@ -72,12 +72,12 @@ inline bool
MPI::Info::Get_valuelen(const char* key, int& valuelen) const
{
int flag;
(void) MPI_Info_get_valuelen(mpi_info, (char*)key, &valuelen, &flag);
(void) MPI_Info_get_valuelen(mpi_info, const_cast<char *>(key), &valuelen, &flag);
return (bool) flag;
}
inline void
MPI::Info::Set(const char* key, const char* value)
{
(void) MPI_Info_set(mpi_info, (char*)key, (char*)value);
(void) MPI_Info_set(mpi_info, const_cast<char *>(key), const_cast<char *>(value));
}

Просмотреть файл

@ -55,7 +55,7 @@ MPI::Intracomm::Gather(const void *sendbuf, int sendcount,
void *recvbuf, int recvcount,
const MPI::Datatype & recvtype, int root) const
{
(void)MPI_Gather((void *)sendbuf, sendcount, sendtype,
(void)MPI_Gather(const_cast<void *>(sendbuf), sendcount, sendtype,
recvbuf, recvcount, recvtype, root, mpi_comm);
}
@ -65,8 +65,8 @@ MPI::Intracomm::Gatherv(const void *sendbuf, int sendcount,
const int recvcounts[], const int displs[],
const MPI::Datatype & recvtype, int root) const
{
(void)MPI_Gatherv((void *)sendbuf, sendcount, sendtype,
recvbuf, (int *)recvcounts, (int *)displs,
(void)MPI_Gatherv(const_cast<void *>(sendbuf), sendcount, sendtype,
recvbuf, const_cast<int *>(recvcounts), const_cast<int *>(displs),
recvtype, root, mpi_comm);
}
@ -76,7 +76,7 @@ MPI::Intracomm::Scatter(const void *sendbuf, int sendcount,
void *recvbuf, int recvcount,
const MPI::Datatype & recvtype, int root) const
{
(void)MPI_Scatter((void *)sendbuf, sendcount, sendtype,
(void)MPI_Scatter(const_cast<void *>(sendbuf), sendcount, sendtype,
recvbuf, recvcount, recvtype, root, mpi_comm);
}
@ -86,8 +86,8 @@ MPI::Intracomm::Scatterv(const void *sendbuf, const int sendcounts[],
void *recvbuf, int recvcount,
const MPI::Datatype & recvtype, int root) const
{
(void)MPI_Scatterv((void *)sendbuf, (int *) sendcounts,
(int *) displs, sendtype,
(void)MPI_Scatterv(const_cast<void *>(sendbuf), const_cast<int *>(sendcounts),
const_cast<int *>(displs), sendtype,
recvbuf, recvcount, recvtype,
root, mpi_comm);
}
@ -97,7 +97,7 @@ MPI::Intracomm::Allgather(const void *sendbuf, int sendcount,
const MPI::Datatype & sendtype, void *recvbuf,
int recvcount, const MPI::Datatype & recvtype) const
{
(void)MPI_Allgather((void *) sendbuf, sendcount,
(void)MPI_Allgather(const_cast<void *>(sendbuf), sendcount,
sendtype, recvbuf, recvcount,
recvtype, mpi_comm);
}
@ -108,9 +108,9 @@ MPI::Intracomm::Allgatherv(const void *sendbuf, int sendcount,
const int recvcounts[], const int displs[],
const MPI::Datatype & recvtype) const
{
(void)MPI_Allgatherv((void *)sendbuf, sendcount,
(void)MPI_Allgatherv(const_cast<void *>(sendbuf), sendcount,
sendtype, recvbuf,
(int *) recvcounts, (int *) displs,
const_cast<int *>(recvcounts), const_cast<int *>(displs),
recvtype, mpi_comm);
}
@ -119,7 +119,7 @@ MPI::Intracomm::Alltoall(const void *sendbuf, int sendcount,
const MPI::Datatype & sendtype, void *recvbuf,
int recvcount, const MPI::Datatype & recvtype) const
{
(void)MPI_Alltoall((void *) sendbuf, sendcount,
(void)MPI_Alltoall(const_cast<void *>(sendbuf), sendcount,
sendtype, recvbuf, recvcount,
recvtype, mpi_comm);
}
@ -130,9 +130,11 @@ MPI::Intracomm::Alltoallv(const void *sendbuf, const int sendcounts[],
void *recvbuf, const int recvcounts[],
const int rdispls[], const MPI::Datatype & recvtype) const
{
(void)MPI_Alltoallv((void *) sendbuf, (int *) sendcounts,
(int *) sdispls, sendtype, recvbuf,
(int *) recvcounts, (int *) rdispls,
(void)MPI_Alltoallv(const_cast<void *>(sendbuf),
const_cast<int *>(sendcounts),
const_cast<int *>(sdispls), sendtype, recvbuf,
const_cast<int *>(recvcounts),
const_cast<int *>(rdispls),
recvtype,mpi_comm);
}
@ -142,10 +144,13 @@ MPI::Intracomm::Alltoallw(const void *sendbuf, const int sendcounts[],
void *recvbuf, const int recvcounts[],
const int rdispls[], const Datatype recvtypes[]) const
{
(void)MPI_Alltoallw((void *) sendbuf, (int *) sendcounts,
(int *) sdispls, (MPI_Datatype *) sendtypes, recvbuf,
(int *) recvcounts, (int *) rdispls,
(MPI_Datatype *) recvtypes, mpi_comm);
(void)MPI_Alltoallw(const_cast<void *>(sendbuf),
const_cast<int *>(sendcounts),
const_cast<int *>(sdispls),
(MPI_Datatype *)(sendtypes), recvbuf,
const_cast<int *>(recvcounts),
const_cast<int *>(rdispls),
(MPI_Datatype *)(recvtypes), mpi_comm);
}
inline void
@ -154,7 +159,7 @@ MPI::Intracomm::Reduce(const void *sendbuf, void *recvbuf, int count,
int root) const
{
current_op = (MPI::Op*)&op;
(void)MPI_Reduce((void*)sendbuf, recvbuf, count, datatype, op, root, mpi_comm);
(void)MPI_Reduce(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, root, mpi_comm);
current_op = (Op*)0;
}
@ -163,7 +168,7 @@ MPI::Intracomm::Allreduce(const void *sendbuf, void *recvbuf, int count,
const MPI::Datatype & datatype, const MPI::Op& op) const
{
current_op = (MPI::Op*)&op;
(void)MPI_Allreduce ((void*)sendbuf, recvbuf, count, datatype, op, mpi_comm);
(void)MPI_Allreduce (const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
current_op = (Op*)0;
}
@ -174,7 +179,7 @@ MPI::Intracomm::Reduce_scatter(const void *sendbuf, void *recvbuf,
const MPI::Op& op) const
{
current_op = (MPI::Op*)&op;
(void)MPI_Reduce_scatter((void*)sendbuf, recvbuf, recvcounts,
(void)MPI_Reduce_scatter(const_cast<void *>(sendbuf), recvbuf, recvcounts,
datatype, op, mpi_comm);
current_op = (Op*)0;
}
@ -184,7 +189,7 @@ MPI::Intracomm::Scan(const void *sendbuf, void *recvbuf, int count,
const MPI::Datatype & datatype, const MPI::Op& op) const
{
current_op = (MPI::Op*)&op;
(void)MPI_Scan((void *)sendbuf, recvbuf, count, datatype, op, mpi_comm);
(void)MPI_Scan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
current_op = (Op*)0;
}
@ -194,7 +199,7 @@ MPI::Intracomm::Exscan(const void *sendbuf, void *recvbuf, int count,
const MPI::Op& op) const
{
current_op = (MPI::Op*)&op;
(void)MPI_Exscan((void *)sendbuf, recvbuf, count, datatype, op, mpi_comm);
(void)MPI_Exscan(const_cast<void *>(sendbuf), recvbuf, count, datatype, op, mpi_comm);
current_op = (Op*)0;
}
@ -253,7 +258,7 @@ MPI::Intracomm::Create_cart(int ndims, const int dims[],
int_periods[i] = (int) periods[i];
MPI_Comm newcomm;
(void)MPI_Cart_create(mpi_comm, ndims, (int*)dims,
(void)MPI_Cart_create(mpi_comm, ndims, const_cast<int *>(dims),
int_periods, (int)reorder, &newcomm);
delete [] int_periods;
return newcomm;
@ -264,8 +269,8 @@ MPI::Intracomm::Create_graph(int nnodes, const int index[],
const int edges[], bool reorder) const
{
MPI_Comm newcomm;
(void)MPI_Graph_create(mpi_comm, nnodes, (int*)index,
(int*)edges, (int)reorder, &newcomm);
(void)MPI_Graph_create(mpi_comm, nnodes, const_cast<int *>(index),
const_cast<int *>(edges), (int)reorder, &newcomm);
return newcomm;
}
@ -280,7 +285,7 @@ MPI::Intracomm::Accept(const char* port_name,
int root) const
{
MPI_Comm newcomm;
(void) MPI_Comm_accept((char *) port_name, info, root, mpi_comm,
(void) MPI_Comm_accept(const_cast<char *>(port_name), info, root, mpi_comm,
&newcomm);
return newcomm;
}
@ -292,7 +297,7 @@ MPI::Intracomm::Connect(const char* port_name,
int root) const
{
MPI_Comm newcomm;
(void) MPI_Comm_connect((char *) port_name, info, root, mpi_comm,
(void) MPI_Comm_connect(const_cast<char *>(port_name), info, root, mpi_comm,
&newcomm);
return newcomm;
}
@ -304,7 +309,7 @@ MPI::Intracomm::Spawn(const char* command, const char* argv[],
int root) const
{
MPI_Comm newcomm;
(void) MPI_Comm_spawn((char *) command, (char **) argv, maxprocs,
(void) MPI_Comm_spawn(const_cast<char *>(command), const_cast<char **>(argv), maxprocs,
info, root, mpi_comm, &newcomm,
(int *)MPI_ERRCODES_IGNORE);
return newcomm;
@ -317,7 +322,7 @@ MPI::Intracomm::Spawn(const char* command, const char* argv[],
int root, int array_of_errcodes[]) const
{
MPI_Comm newcomm;
(void) MPI_Comm_spawn((char *) command, (char **) argv, maxprocs,
(void) MPI_Comm_spawn(const_cast<char *>(command), const_cast<char **>(argv), maxprocs,
info, root, mpi_comm, &newcomm,
array_of_errcodes);
return newcomm;
@ -332,8 +337,8 @@ MPI::Intracomm::Spawn_multiple(int count,
const Info array_of_info[], int root)
{
MPI_Comm newcomm;
MPI_Comm_spawn_multiple(count, (char **) array_of_commands,
(char ***) array_of_argv, (int *) array_of_maxprocs,
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
const_cast<char ***>(array_of_argv), const_cast<int *>(array_of_maxprocs),
(MPI_Info *) array_of_info, root,
mpi_comm, &newcomm, (int *)MPI_ERRCODES_IGNORE);
return newcomm;
@ -349,8 +354,8 @@ MPI::Intracomm::Spawn_multiple(int count,
int array_of_errcodes[])
{
MPI_Comm newcomm;
MPI_Comm_spawn_multiple(count, (char **) array_of_commands,
(char ***) array_of_argv, (int *) array_of_maxprocs,
MPI_Comm_spawn_multiple(count, const_cast<char **>(array_of_commands),
const_cast<char ***>(array_of_argv), const_cast<int *>(array_of_maxprocs),
(MPI_Info *) array_of_info, root,
mpi_comm, &newcomm, array_of_errcodes);
return newcomm;

Просмотреть файл

@ -265,7 +265,7 @@ MPI::Request::Testsome(int incount, MPI::Request req_array[],
inline void
MPI::Request::Cancel(void) const
{
(void)MPI_Cancel((MPI_Request*)&mpi_request);
(void)MPI_Cancel(const_cast<MPI_Request *>(&mpi_request));
}
inline void

Просмотреть файл

@ -26,7 +26,7 @@ MPI::Status::Get_count(const MPI::Datatype& datatype) const
{
int count;
//(MPI_Status*) is to cast away the const
(void)MPI_Get_count((MPI_Status*)&mpi_status, datatype, &count);
(void)MPI_Get_count(const_cast<MPI_Status*>(&mpi_status), datatype, &count);
return count;
}
@ -34,7 +34,7 @@ inline bool
MPI::Status::Is_cancelled() const
{
int t;
(void)MPI_Test_cancelled((MPI_Status*)&mpi_status, &t);
(void)MPI_Test_cancelled(const_cast<MPI_Status*>(&mpi_status), &t);
return (bool) t;
}
@ -42,7 +42,7 @@ inline int
MPI::Status::Get_elements(const MPI::Datatype& datatype) const
{
int count;
(void)MPI_Get_elements((MPI_Status*)&mpi_status, datatype, &count);
(void)MPI_Get_elements(const_cast<MPI_Status*>(&mpi_status), datatype, &count);
return count;
}

Просмотреть файл

@ -80,7 +80,7 @@ inline int
MPI::Cartcomm::Get_cart_rank(const int coords[]) const
{
int rank;
(void)MPI_Cart_rank(mpi_comm, (int*)coords, &rank);
(void)MPI_Cart_rank(mpi_comm, const_cast<int *>(coords), &rank);
return rank;
}
@ -120,7 +120,7 @@ MPI::Cartcomm::Map(int ndims, const int dims[], const bool periods[]) const
int_periods[i] = (int) periods[i];
}
int newrank;
(void)MPI_Cart_map(mpi_comm, ndims, (int*)dims, int_periods, &newrank);
(void)MPI_Cart_map(mpi_comm, ndims, const_cast<int *>(dims), int_periods, &newrank);
delete [] int_periods;
return newrank;
}
@ -203,7 +203,7 @@ MPI::Graphcomm::Map(int nnodes, const int index[],
const int edges[]) const
{
int newrank;
(void)MPI_Graph_map(mpi_comm, nnodes, (int*)index, (int*)edges, &newrank);
(void)MPI_Graph_map(mpi_comm, nnodes, const_cast<int *>(index), const_cast<int *>(edges), &newrank);
return newrank;
}

Просмотреть файл

@ -63,7 +63,7 @@ MPI::Win::Accumulate(const void* origin_addr, int origin_count,
const MPI::Datatype& target_datatype,
const MPI::Op& op) const
{
(void) MPI_Accumulate((void*) origin_addr, origin_count, origin_datatype,
(void) MPI_Accumulate(const_cast<void *>(origin_addr), origin_count, origin_datatype,
target_rank, target_disp, target_count,
target_datatype, op, mpi_win);
@ -83,7 +83,7 @@ MPI::Win::Create(const void* base, MPI::Aint size,
const MPI::Intracomm& comm)
{
MPI_Win newwin;
(void) MPI_Win_create((void *)base, size, disp_unit, info, comm, &newwin);
(void) MPI_Win_create(const_cast<void *>(base), size, disp_unit, info, comm, &newwin);
return newwin;
}
@ -109,7 +109,7 @@ MPI::Win::Get(const void *origin_addr, int origin_count,
int target_count,
const MPI::Datatype& target_datatype) const
{
(void) MPI_Get((void*) origin_addr, origin_count, origin_datatype,
(void) MPI_Get(const_cast<void *>(origin_addr), origin_count, origin_datatype,
target_rank, target_disp,
target_count, target_datatype, mpi_win);
@ -146,7 +146,7 @@ MPI::Win::Put(const void* origin_addr, int origin_count,
int target_count,
const MPI::Datatype& target_datatype) const
{
(void) MPI_Put((void*) origin_addr, origin_count, origin_datatype,
(void) MPI_Put(const_cast<void *>(origin_addr), origin_count, origin_datatype,
target_rank, target_disp, target_count,
target_datatype, mpi_win);
@ -243,14 +243,14 @@ MPI::Win::Get_name(char* win_name, int& resultlen) const
inline void
MPI::Win::Set_attr(int win_keyval, const void* attribute_val)
{
(void) MPI_Win_set_attr(mpi_win, win_keyval,(void *) attribute_val);
(void) MPI_Win_set_attr(mpi_win, win_keyval, const_cast<void *>(attribute_val));
}
inline void
MPI::Win::Set_name(const char* win_name)
{
(void) MPI_Win_set_name(mpi_win, (char *)win_name);
(void) MPI_Win_set_name(mpi_win, const_cast<char *>(win_name));
}