LibCapy - voting

Voting systems implementation.

Macros:

Enumerations:

None.

Typedefs:

None.

Struct CapyRankedChoiceVote :

Struct CapyRankedChoiceVote's properties:

Current choice (default: 0)

Ranking of choices (initialised to 0, 1, 2, ...)

Struct CapyRankedChoiceVote's methods:

None.

Struct CapyRankedChoiceVotingResult :

Struct CapyRankedChoiceVotingResult's properties:

Number of votes for each choice before being eliminated (so the winner(s) can be determined by decreasing number of votes).

Struct CapyRankedChoiceVotingResult's methods:

None.

Struct CapyRankedChoiceVoting :

Struct CapyRankedChoiceVoting's properties:

Number of choice

Number of voter

Voter's choices

Struct CapyRankedChoiceVoting's methods:

Destructor

Set a voter's ranking for a given choice

Input argument(s):

iVoter: id of the voter
iRanking: updated ranking
iChoice: id of the choice for the given voter and ranking

Output and side effect(s):

The choice for he given rank and voter is updated

Get the result of election

Output and side effect(s):

Check the integrity of the votes and if they are correct return the result, else raise CapyExc_InvalidParameters. The voters' choice is updated.

Functions:

Create a CapyRankedChoiceVoting

Input argument(s):

nbChoice: number of choice
nbVoter: number of voter

Output and side effect(s):

Return a CapyRankedChoiceVoting.

Allocate memory for a new CapyRankedChoiceVoting and create it

Input argument(s):

nbChoice: number of choice
nbVoter: number of voter

Output and side effect(s):

Return a CapyRankedChoiceVoting

Exception(s):

May raise CapyExc_MallocFailed.

Free the memory used by a CapyRankedChoiceVoting* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyRankedChoiceVoting to free

2025-03-30
in LibCapy,
0 views
Copyright 2021-2025 Baillehache Pascal