dalen
dalen

Reputation: 13

Visual C++ Can't Properly fill Constructor Requirements

So I can't seem to properly fill the requirements for this constructor.

DIVA_STATUS DIVA_getObjectDetailsList (
IN BOOL                   pFirstTime,
IN time_t                 *initialTime,
IN int                    pListType,
IN int                    pObjectsListType,
IN int                    pMaxListSize,
IN DIVA_STRING            pObjectName,
IN DIVA_STRING            pObjectCategory
IN DIVA_STRING            pMediaName
DIVA_LEVEL_OF_DETAIL      pLevelOfDetail,
IN vector<DIVA_STRING>    listPosition,
OUT vector<DIVA_OBJECT_DETAILS_LIST>      *&pObjectDetailsList
)

The problem seems to be the last line which outputs a vector of classes (???). I'm a little rusty with C++ so I cant recall why you would dereference a reference call (*&).

DIVA_OBJECT_DETAILS_LIST is a class shown below:

class DIVA_OBJECT_DETAILS_LIST {
public:
int                            listType;
DIVA_STRING                    siteID;
vector<DIVA_STRING>            *listPosition;
vector<DIVA_OBJECT_INFO>       *objectInfo;
vector<DIVA_OBJECT_TAPE_INFO>  *objectTapeInfo;
};

Here is what I get when I try compiling using VC++ 2008 Express

1>Compiling...
1>initiator.cpp
1>.\initiator.cpp(148) : error C2100: illegal indirection
1>.\initiator.cpp(148) : error C2665: 'DIVA_getObjectDetailsList' : none of the 2 overloads could convert all the argument types
1>        z:\Mediavault1\Automation\DIVA_API\DIVArchiveAPI\CppAPI Test\include\DIVAapi.h(2191): could be 'DIVA_STATUS DIVA_getObjectDetailsList(bool,time_t,int,int,int,DIVA_STRING,DIVA_STRING,DIVA_STRING,DIVA_LEVEL_OF_DETAIL,std::vector<_Ty>,DIVA_OBJECT_DETAILS_LIST *&)'
1>        with
1>        [
1>            _Ty=DIVA_STRING
1>        ]
1>        while trying to match the argument list '(bool, time_t, int, int, int, DIVA_STRING, DIVA_STRING, DIVA_STRING, DIVA_LEVEL_OF_DETAIL, std::vector<_Ty>, DIVA_OBJECT_DETAILS_LIST *)'
1>        with
1>        [
1>            _Ty=DIVA_STRING
1>        ]

Here is how I'm calling the constructor:

cr = DIVA_getObjectDetailsList (
                   _firstTime,
                   (time_t)_initDate,
                   (int)DIVA_OBJECTS_LIST,
                   (int)DIVA_OBJECTS_CREATED_SINCE,
                   _size,
                   _name,
                   _category,
                   _group,
                   DIVA_INSTANCE,
                   *_listType.listPosition,
                   &*_listType
                   );

_listType is DIVA_OBJECT_DETAILS_LIST. How do I pass it pointer by reference?

Upvotes: 1

Views: 122

Answers (1)

Joseph Mansfield
Joseph Mansfield

Reputation: 110658

The problem appears to be with the second to last argument. You are passing a std::vector<DIVA_STRING>* when you should just be passing a std::vector<DIVA_STRING> (not a pointer).

But to help your understanding about the last argument, vector<DIVA_OBJECT_DETAILS_LIST>*& is a "reference to pointer to vector<DIVA_OBJECT_DETAILS_LIST>" type. That is, you should pass a pointer and it is passed by reference.

Upvotes: 2

Related Questions