finish up plugin architecture
[csRadar.git] / csrComb.h
index 1a549d48e4228968499cf0bd2ac20f25ef568eed..92a1e0d2fe0bf1c47428b53cd624ea4da824c361 100644 (file)
--- a/csrComb.h
+++ b/csrComb.h
@@ -1,3 +1,39 @@
+// Copyright (C) 2021 Harry Godden (hgn)
+
+// API
+//=======================================================================================================================
+
+// Algorithm 1: Generate non-repeating combinations of size M in set of N
+// Usage:
+//   int p[3];
+//   hgn_comb_init( 3, p );
+//   
+//   do
+//   {
+//      something with p[0], p[1], p[2]
+//   }
+//   while( hgn_comb( 3, 5, p ) );
+//
+//   Output of p each iteration:
+//     0 1 2
+//     0 1 3
+//     0 1 4
+//     0 2 3
+//     0 2 4
+//     0 3 4
+//     1 2 3
+//     1 2 4
+//     1 3 4
+//     2 3 4
+
+void csr_comb_init( int const M, int p[] );
+int csr_comb( int M, int N, int p[] );
+
+// Implementation
+//=======================================================================================================================
+
+#ifdef CSR_EXECUTABLE
+
 void csr_comb_init( int const M, int p[] )
 {
        for( int i = 0; i < M; i ++ )
@@ -22,3 +58,5 @@ int csr_comb( int M, int N, int p[] )
        }
        return 0;
 }
+
+#endif